New issue
 Projects > cocos2d-x > Issues > Bug #5997

The program is blocked when closing websocket in connecting state

Bug #5997 [New]
1521743105@qq.com 2014-10-21 10:45

Code fragment:
local ws = cc.WebSocket:create("url here")
local function onOpen()
print("ws open")
end
local function onClose()
print("ws close")
end
local function onMessage(msg)
print("ws msg is " .. msg)
end
local function onError()
print("ws error occurs")
end
ws:registerScriptHandler(onOpen, cc.WEBSOCKET_OPEN)
ws:registerScriptHandler(onClose, cc.WEBSOCKET_CLOSE)
ws:registerScriptHandler(onMessage, cc.WEBSOCKET_MESSAGE)
ws:registerScriptHandler(onError, cc.WEBSOCKET_ERROR)
if ws:getReadyState() == cc.WEBSOCKET_STATE_CONNECTING then
ws:close()
end

The program will be blocked, and the following code will not be executed!!! (cocos2d-x 3.2 lua)

Atom PDF

Status:New
Start date:2014-10-21
Priority:Low
Due date:
Assignee:-
% Done:

0%

Category:all, android, ios, lua, osx
Target version:-