mirror of
https://github.com/defold/extension-websocket.git
synced 2025-09-27 07:52:18 +02:00
updated documentation
This commit is contained in:
@@ -65,15 +65,16 @@
|
||||
```lua
|
||||
local function websocket_callback(self, conn, data)
|
||||
if data.event == websocket.EVENT_DISCONNECTED then
|
||||
print("disconnected " .. conn)
|
||||
log("Disconnected: " .. tostring(conn))
|
||||
self.connection = nil
|
||||
update_gui(self)
|
||||
elseif data.event == websocket.EVENT_CONNECTED then
|
||||
print("Connected " .. conn)
|
||||
-- self.connection = conn
|
||||
update_gui(self)
|
||||
log("Connected: " .. tostring(conn))
|
||||
elseif data.event == websocket.EVENT_ERROR then
|
||||
print("Error:", data.error)
|
||||
log("Error: '" .. data.error .. "'")
|
||||
elseif data.event == websocket.EVENT_MESSAGE then
|
||||
print("Receiving: '" .. tostring(data.message) .. "'")
|
||||
log("Receiving: '" .. tostring(data.message) .. "'")
|
||||
end
|
||||
end
|
||||
|
||||
|
Reference in New Issue
Block a user