mirror of
https://github.com/defold/extension-websocket.git
synced 2025-09-27 07:52:18 +02:00
Added status code to callback when the server closes the connection (#45)
* Added WebSocket close code to callback Also added message and code for HTML5 * Unify disconnect handling for wslay and html5
This commit is contained in:
@@ -1,4 +1,4 @@
|
||||
local URL = "echo.websocket.org"
|
||||
local URL = "echo.websocket.events"
|
||||
|
||||
local function click_button(node, action)
|
||||
return gui.is_enabled(node) and action.pressed and gui.pick_node(node, action.x, action.y)
|
||||
@@ -57,7 +57,7 @@ end
|
||||
|
||||
local function websocket_callback(self, conn, data)
|
||||
if data.event == websocket.EVENT_DISCONNECTED then
|
||||
log("Disconnected: " .. tostring(conn))
|
||||
log("Disconnected: " .. tostring(conn) .. " Code: " .. data.code .. " Message: " .. tostring(data.message))
|
||||
self.connection = nil
|
||||
update_gui(self)
|
||||
elseif data.event == websocket.EVENT_CONNECTED then
|
||||
|
Reference in New Issue
Block a user