WebSocketEvents
Constants
CLOSE
Triggered when the WebSocket connection is closed. WebSocket.onclose is called right before any other handlers.
Parameters
- code:- WebSocket close code. 
- reason:- string - Reason why the connection is closed. 
- wasClean:- boolean - Whether the connection is cleanly closed. 
- websocket:- WebSocket object that triggered the event. 
CREATED
Triggered when the WebSocket connection is created. WebSocket.oncreated is called right before any other handlers.
Parameters
- statisticsUrl:- string Optional- Exists when statistics is enabled. 
- websocket:- WebSocket object that triggered the event. 
ERROR
Triggers when an error occurs during the WebSocket connection. WebSocket.onerror is called right before any other handlers.
Parameters
- websocket:- WebSocket object that triggered the event. 
MEDIA_ENDED
Triggers after the end of the audio stream sent by a third party through a WebSocket (1 second of silence).
Parameters
- mediaInfo:Optional- Information about the audio stream that can be obtained after the stream stops or pauses (1 second of silence). 
- tag:- string Optional- Special tag to name audio streams sent over one WebSocket connection. With it, one can send 2 audios to 2 different media units at the same time. 
- websocket:- WebSocket object that triggered the event. 
MEDIA_STARTED
Triggered when the audio stream sent by a third party through a WebSocket is started playing.
Parameters
- customParameters:- {[key: string]: string} Optional- Custom parameters. 
- encoding:- string Optional- Audio encoding formats. 
- tag:- string Optional- Special tag to name audio streams sent over one WebSocket connection. With it, one can send 2 audios to 2 different media units at the same time. 
- websocket:- WebSocket object that triggered the event. 
MESSAGE
Triggered when a message is received by a target object. WebSocket.onmessage is called right before any other handlers.
Parameters
- text:- string - The data sent by the message emitter. 
- websocket:- WebSocket object that triggered the event. 
OPEN
Triggered when the WebSocket connection is opened. WebSocket.onopen is called right before any other handlers.
Parameters
- websocket:- WebSocket object that triggered the event.