Merge branch 'master' of github.com:defold/extension-websocket

This commit is contained in:
JCash 2020-09-04 12:04:16 +02:00
commit ab1b52c676

View File

@ -100,6 +100,35 @@
type: object type: object
desc: the websocket connection desc: the websocket connection
#*****************************************************************************************************
- name: send
type: function
desc: Send data on a websocket
parameters:
- name: connection
type: object
desc: the websocket connection
- name: message
type: string
desc: the message to send
examples:
- desc: |-
```lua
local function websocket_callback(self, conn, data)
if data.event == websocket.EVENT_CONNECTED then
websocket.send(conn, "Hello from the other side")
end
end
function init(self)
self.url = "ws://echo.websocket.org"
local params = {}
self.connection = websocket.connect(self.url, params, websocket_callback)
end
```
#***************************************************************************************************** #*****************************************************************************************************
- name: EVENT_CONNECTED - name: EVENT_CONNECTED