The transport layer is responsible for the actual transmission of requests and responses over network transports. For SIP.js, this includes maintaining the WebSocket connection, as well as sending and receiving SIP requests and responses over the WebSocket.
- Instance Variables
- Instance Methods
- WebSocket server
The construction of a transport is not meant to be done manually. Instead, SIP.js user agents create a transport to use for themselves. The UA is passed in so that incoming messages may be routed to the appropriate transactions for processing.
When constructed, the new Transport will assign itself as the UA’s transport property before automatically attempting to connect to the designated WebSocket server.
Logger - The outlet for log messages.
SIP.UA - The UA using the transport
WebSocket - The WebSocket used for sending and receiving messages.
Object - The wsServer object the transport connects to, from the UA
Integer - The number of times the Transport has attempted to reconnect in
event of error.
Boolean - Whether or not the UA has requested the Transport be closed.
Boolean - Whether or not the WebSocket connection is open.
Integer - Global timer ID used to track time between reconnection attempts.
Object - When the WebSocket is closed, any error condition gets stored here.
Send a message along the WebSocket
||A SIP Request (represented as a String or SIP.OutgoingRequest) to send along the WebSocket.|
true if the WebSocket is open for sending. Otherwise,
Create and open a new WebSocket connection to the configured WebSocket server.
Disconnect from the WebSocket and cancel any reconnection attempts.
Internal Reconnect to the WebSocket in the event of unexpected disconnection. This will attempt to reconnect up to
ua.configuration.wsServerMaxReconnection times, with a gap of
ua.configuration.wsServerReconnectionTimeout seconds between each request.
Internal This method is called when the WebSocket is opened. Its primary purpose is to clear the reconnection attempts and notify the UA.
Internal This method is called when the WebSocket is closed. Its primary purpose is to notify the UA and attempt to reconnect if necessary.
Internal This method is called when a message is received from the WebSocket. It parses the SIP message, runs sanity checks, and passes it to the UA (for requests) or transaction (for responses) for processing.
Internal Logs an error when the WebSocket errors. Errors typically also disconnect the WebSocket, so no extra handling is done here.