Signature |
hs.websocket.new(url, callback) -> object |
Type |
Function |
Description |
Creates a new websocket connection. |
Parameters |
- url - The URL to the websocket
- callback - A function that's triggered by websocket actions.
|
Returns |
|
Notes |
- The callback should accept two parameters.
- The first paramater is a string with the following possible options:
- open - The websocket connection has been opened
- closed - The websocket connection has been closed
- fail - The websocket connection has failed
- received - The websocket has received a message
- pong - A pong request has been received
- The second parameter is a string with the recieved message or an error message.
- Given a path '/mysock' and a port of 8000, the websocket URL is as follows:
- ws://localhost:8000/mysock
- wss://localhost:8000/mysock (if SSL enabled)
|
Source |
extensions/websocket/internal.m |