Tip: avoid reserved SDK types (subscribe
| unsubscribe
| channelMessage
) for custom protocols.
const vdo = new VDONinjaSDK(options)
wss://wss.vdo.ninja
)connect()
, disconnect()
joinRoom({ room, password })
, leaveRoom()
autoConnect(roomOrOptions, filter?)
→ { stop, streamID }
publish(stream, { streamID, room?, label?, password? })
announce({ streamID?, room?, label?, password? })
stopPublishing()
view(streamID, { audio=true, video=true, label? })
stopViewing(streamID)
quickPublish({ stream, room?, streamID?, label?, password? })
quickView({ streamID, room?, audio?, video?, label?, password?, dataOnly? })
quickSubscribe({ streamID, room?, ... })
(defaults to data-only)sendData(data, target?)
— flexible targeting with DC and fallbacksendPing(uuid?)
request(type, data, targetUUID, timeout?)
, respond(id, data, targetUUID)
onRequest(type, handler)
subscribe(channels)
, unsubscribe(channels)
, getSubscriptions()
publishToChannel(channel, data, target='all')
getPeerSubscriptions(uuid)
channelMessage
, peerSubscribed
, peerUnsubscribed
getStats(uuid?)
play|watch|startViewing → view
, stream|broadcast|startPublishing|share → publish
, quickStream|quickBroadcast|quickShare → quickPublish
, stop|stopPlaying|stopWatching → stopViewing
, stopStreaming|stopBroadcasting|stopSharing|unpublish → stopPublishing
, join|enterRoom|enter → joinRoom
, leave|exitRoom → leaveRoom
connected
, disconnected
, reconnecting
, reconnected
, reconnectFailed
roomJoined
, roomLeft
, listing
, peerListing
peerConnected
, peerDisconnected
, dataChannelOpen
, dataChannelClose
, peerInfo
, peerLatency
dataReceived
(dataRecieved
alias), data
track
, trackAdded
, trackRemoved
, trackReplaced
publishing
, publishingStopped
, viewingStopped
, iceRestart
, connectionFailed
, alert
, error