mirror of
https://github.com/defold/extension-websocket.git
synced 2025-09-27 16:02: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:
@@ -61,6 +61,14 @@
|
||||
type: string
|
||||
desc: The received data if event is `websocket.EVENT_MESSAGE`. Error message otherwise
|
||||
|
||||
- name: handshake_response
|
||||
type: table
|
||||
desc: Handshake response information (status, headers etc)
|
||||
|
||||
- name: code
|
||||
type: number
|
||||
desc: Status code received from the server if the server closed the connection. Only present if event is `EVENT_DISCONNECTED`.
|
||||
|
||||
|
||||
returns:
|
||||
- name: connection
|
||||
@@ -86,7 +94,7 @@
|
||||
end
|
||||
|
||||
function init(self)
|
||||
self.url = "ws://echo.websocket.org"
|
||||
self.url = "ws://echo.websocket.events"
|
||||
local params = {
|
||||
timeout = 3000,
|
||||
headers = "Sec-WebSocket-Protocol: chat\r\nOrigin: mydomain.com\r\n"
|
||||
|
Reference in New Issue
Block a user