WebSocket
Represents a WebSocket instance that provides the API for creating and managing an outgoing or incoming WebSocket connection, as well as for sending and…
Represents a WebSocket instance that provides the API for creating and managing an outgoing or incoming WebSocket connection, as well as for sending and receiving data to/from it.
Constructor
Parameters
Parameters
Methods
addEventListener
Adds a handler for the specified WebSocketEvents event. Use only functions as handlers; anything except a function leads to the error and scenario termination when a handler is called.
Parameters
clearMediaBuffer
Clears the media buffer.
Parameters
close
Closes the WebSocket connection or connection attempt.
id
Returns the WebSocket’s id.
removeEventListener
Removes a handler for the specified WebSocketEvents event.
Parameters
send
Enqueues the specified data to be transmitted over the WebSocket connection.
Parameters
sendMediaTo
Starts sending media from the websocket to the media unit. WebSocket works in real time and the recommended duration of one audio chunk is 20 milliseconds.
Parameters
stopMediaTo
Stops sending media from the websocket to the media unit.
Parameters
Properties
Event handler to call when the connection is closed.
Event handler to call when the connection is created.
Event handler to call when an error occurs.
Event handler to call after the end of the audio stream.
Event handler to call when the audio stream is started playing.
Event handler to call when a message is received.
Event handler to call when the connection is open (ready to send and receive data).
readonly
Returns the current state of the WebSocket connection.
readonly
Returns the absolute URL of the WebSocket. For outgoing connection, it is the URL to which to connect; for incoming, it is the WebSocket session URL.