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

The program is blocked when closing websocket in connecting state

Bug #5996 [New]
1521743105@qq.com 2014-10-21 10:43

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

Atom PDF

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

0%

Category:-
Target version:-