Signaling

Signaling

Start the WebSocket connection and manage the messages between peers.

Constructor

# new Signaling(options)

Parameters:
Name Type Description
options Object

Available signaling options.

Properties
Name Type Description
streamName String

The name of the Wowza Video real-time stream.

url String

The WebSocket URL to signal Wowza Video and establish a WebRTC connection.

Example
const wowzaSignaling = new Signaling(options)

Extends

  • EventEmitter

Methods

# close()

Close the WebSocket connection with Wowza Video.

Example
wowzaSignaling.close()

# (async) cmd(cmd, dataopt) → {Promise.<Object>}

Send a command to the server.

Parameters:
Name Type Attributes Description
cmd String

The command name.

data Object <optional>

The command parameters.

Returns:

A promise object that represents the command response.

Type
Promise.<Object>

# (async) connect() → {Promise.<WebSocket>}

Start a WebSocket connection with the signaling server.

Returns:

Promise object that represents the WebSocket object of the established connection.

Type
Promise.<WebSocket>
Example
const response = await wowzaSignaling.connect()

# (async) publish(sdp, options) → {Promise.<String>}

Establish a WebRTC connection with Wowza Video as the Publisher role.

Parameters:
Name Type Description
sdp String

The SDP information created by your offer.

options SignalingPublishOptions

Signaling Publish Options.

Returns:

A promise object that represents the SDP command response.

Type
Promise.<String>
Example
const response = await wowzaSignaling.publish(sdp, {codec: 'h264'})

# (async) subscribe(sdp, options) → {Promise.<String>}

Establish a WebRTC connection with Wowza Video as the Subscriber role.

Parameters:
Name Type Description
sdp String

The SDP information created by your offer.

options SignalingSubscribeOptions

Signaling Subscribe Options.

Returns:

A promise object that represents the SDP command response.

Type
Promise.<String>
Example
const response = await wowzaSignaling.subscribe(sdp)

Events

# broadcastEvent

Passthrough of available Wowza broadcast events.

Active - Fires when the live stream is, or has started broadcasting.

Inactive - Fires when the stream has stopped broadcasting, but is still available.

Stopped - Fires when the stream has stopped for a given reason.

Vad - Fires when using multiplexed tracks for audio.

Layers - Fires when there is an update of the state of the layers in a stream (when broadcasting with simulcast).

Migrate - Fires when the server is having problems, is shutting down or when viewers need to move for load balancing purposes.

Viewercount - Fires when the viewer count changes.

More information here: https://docs.dolby.io/streaming-apis/docs/web#broadcast-events

Type:
  • Object
Properties
Name Type Description
type String

The type of message. Use "event".

name "active" | "inactive" | "stopped" | "vad" | "layers" | "migrate" | "viewercount"

The event name.

data Object

Custom event data.

# wsConnectionClose

The WebSocket connection with the signaling server was successfully closed.

# wsConnectionError

The WebSocket connection with the signaling server failed. Returns the URL of the WebSocket.

Type:
  • String

# wsConnectionSuccess

The WebSocket connection was successfully established with the signaling server.

Type:
  • Object
Properties
Name Type Description
ws WebSocket

The WebSocket object that represents an active connection.

tm TransactionManager

The TransactionManager object that simplifies WebSocket commands.