Class BO.WSocketWrapper
Creates a wrapper for various websocket implementations to unify the interface.
Defined in: WSocketWrapper.js.
| Constructor Attributes | Constructor Name and Description |
|---|---|
|
BO.WSocketWrapper(host, port, useSocketIO, protocol)
Creates a wrapper for various websocket implementations to unify the interface.
|
| Field Attributes | Field Name and Description |
|---|---|
|
[read-only] Wrapper for the readyState method of the native websocket implementation
CONNECTING = 0, OPEN = 1, CLOSING = 2, CLOSED = 3 |
| Method Attributes | Method Name and Description |
|---|---|
|
send(message)
Send a message
|
| Event Attributes | Event Name and Description |
|---|---|
|
The webSocketClosed event is dispatched the websocket connection is closed.
|
|
|
The webSocketConnected event is dispatched when a connection with
the websocket is established.
|
|
|
The webSocketMessage event is dispatched when a websocket message is received.
|
Class Detail
BO.WSocketWrapper(host, port, useSocketIO, protocol)
Creates a wrapper for various websocket implementations to unify the interface.
- Parameters:
- {String} host
- The host address of the web server.
- {Number} port
- The port to connect to on the web server.
- {Boolean} useSocketIO
- Set true to use socket.io implementation, set false to use native websocket implementation.
- {String} protocol
- The websockt protocol definition (if necessary).
Field Detail
{String}
readyState
[read-only] Wrapper for the readyState method of the native websocket implementation
CONNECTING = 0, OPEN = 1, CLOSING = 2, CLOSED = 3
Method Detail
send(message)
Send a message
- Parameters:
- {String} message
- The message to send
Event Detail
{BO.WebsocketEvent.CLOSE}
webSocketClosed
The webSocketClosed event is dispatched the websocket connection is closed.
- This event has the following properties:
- {BO.WSocketWrapper} target
- A reference to the WSocketWrapper object.
{BO.WebsocketEvent.CONNECTED}
webSocketConnected
The webSocketConnected event is dispatched when a connection with
the websocket is established.
- This event has the following properties:
- {BO.WSocketWrapper} target
- A reference to the WSocketWrapper object.
{BO.WebsocketEvent.MESSAGE}
webSocketMessage
The webSocketMessage event is dispatched when a websocket message is received.
- This event has the following properties:
- {BO.WSocketWrapper} target
- A reference to the WSocketWrapper object.
- {String} message
- The websocket data
