Issue 8: Handle the websocket close event

This commit is contained in:
JCash
2020-09-27 16:54:22 +02:00
parent 18a768774f
commit bd8569f49a
6 changed files with 114 additions and 56 deletions

View File

@@ -20,10 +20,13 @@ local function websocket_callback(self, conn, data)
print("Connected " .. conn)
-- self.connection = conn
elseif data.event == websocket.EVENT_ERROR then
print("Error:", data.error)
print("Error:", data.message)
elseif data.event == websocket.EVENT_MESSAGE then
print("Receiving: '" .. tostring(data.message) .. "'")
end
elseif data.event == websocket.EVENT_DISCONNECTED then
print("Disconnected: '" .. tostring(data.message) .. "'")
end
end
function init(self)