Skyway Class
Please check on the init() function on how you can initialize Skyway. Note that:
- You will have to subscribe all Skyway events first before calling init().
- If you need an api key, please register an api key at our developer console.
Constructor
Skyway
()
Example:
// Getting started on how to use Skyway
var SkywayDemo = new Skyway();
SkywayDemo.init('apiKey');
SkywayDemo.joinRoom('my_room', {
userData: 'My Username',
audio: true,
video: true
});
SkywayDemo.on('incomingStream', function (peerId, stream, isSelf) {
if (isSelf) {
attachMediaStream(document.getElementById('selfVideo'), stream);
} else {
var peerVideo = document.createElement('video');
peerVideo.id = peerId;
peerVideo.autoplay = 'autoplay';
document.getElementById('peersVideo').appendChild(peerVideo);
attachMediaStream(peerVideo, stream);
}
});
SkywayDemo.on('peerLeft', function (peerId, peerInfo, isSelf) {
if (isSelf) {
document.getElementById('selfVideo').src = '';
} else {
var peerVideo = document.getElementById(peerId);
document.getElementById('peersVideo').removeChild(peerVideo);
}
});
Item Index
Methods
- _addLocalStream
- _addStereo
- _answerHandler
- _base64ToBlob
- _byeHandler
- _candidateHandler
- _chunkFile
- _clearDataChannelTimeout
- _closeChannel
- _closeDataChannel
- _createDataChannel
- _createPeerConnection
- _dataChannelACKHandler
- _dataChannelDATAHandler
- _dataChannelERRORHandler
- _dataChannelERRORHandler
- _dataChannelHandler
- _dataChannelMESSAGEHandler
- _dataChannelWRQHandler
- _doAnswer
- _doCall
- _enterHandler
- _findSDPLine
- _handleAV
- _inRoomHandler
- _loadInfo
- _muteAudioEventHandler
- _muteVideoEventHandler
- _offerHandler
- _onIceCandidate
- _onRemoteStreamAdded
- _onUserMediaError
- _onUserMediaSuccess
- _openChannel
- _openPeer
- _parseInfo
- _parseStreamSettings
- _privateMessageHandler
- _processingSingleMessage
- _processSigMessage
- _publicMessageHandler
- _redirectHandler
- _reinit
- _removePeer
- _requestServerInfo
- _roomLockEventHandler
- _sendBlobDataToPeer
- _sendDataChannel
- _sendMessage
- _setDataChannelTimeout
- _setFirefoxIceServers
- _setLocalAndSendMessage
- _setSDPBitrate
- _setStreams
- _trigger
- _updateUserEventHandler
- _waitForMediaStream
- _welcomeHandler
- cancelBlobTransfer
- disableAudio
- disableVideo
- enableAudio
- enableVideo
- getPeerInfo
- getUserData
- getUserMedia
- init
- joinRoom
- leaveRoom
- lockRoom
- off
- on
- respondBlobRequest
- sendBlobData
- sendMessage
- sendP2PMessage
- setUserData
- unlockRoom
Attributes
- _apiKey
- _channel_open
- _chunkFileSize
- _dataChannels
- _dataTransfersTimeout
- _defaultRoom
- _downloadDataSessions
- _downloadDataTransfers
- _enableDataChannel
- _enableIceTrickle
- _in_room
- _key
- _mozChunkFileSize
- _path
- _peerConnections
- _peerHSPriorities
- _peerInformations
- _readyState
- _room
- _room_lock
- _roomCredentials
- _roomDuration
- _roomServer
- _roomStart
- _selectedRoom
- _serverPath
- _serverRegion
- _socket
- _socketVersion
- _streamSettings
- _uploadDataSessions
- _uploadDataTransfers
- _user
- CANDIDATE_GENERATION_STATE
- DATA_CHANNEL_STATE
- DATA_TRANSFER_DATA_TYPE
- DATA_TRANSFER_STATE
- DATA_TRANSFER_TYPE
- DC_TYPE
- HANDSHAKE_PROGRESS
- ICE_CONNECTION_STATE
- PEER_CONNECTION_STATE
- READY_STATE_CHANGE
- READY_STATE_CHANGE_ERROR
- REGIONAL_SERVER
- SIG_TYPE
- SYSTEM_ACTION
- VERSION
- VIDEO_RESOLUTION
Events
- candidateGenerationState
- channelClose
- channelError
- channelMessage
- channelOpen
- dataChannelState
- dataTransferState
- handshakeProgress
- incomingMessage
- incomingStream
- mediaAccessError
- mediaAccessSuccess
- peerConnectionState
- peerJoined
- peerLeft
- peerUpdated
- presenceChanged deprecated
- readyStateChange
- roomLock
- systemAction
Methods
_addLocalStream
-
peerId
Sends our Local MediaStream to other Peers. By default, it sends all it's other stream
Parameters:
-
peerIdStringPeerId of the peer to send local stream to.
_addStereo
-
sdpLines
Adds stereo feature to the SDP.
- This requires OPUS to be enabled in the SDP or it will not work.
Parameters:
-
sdpLinesArraySdp received.
Returns:
Updated version with Stereo feature
_answerHandler
-
message.type -
message
Triggers:
handshakeProgressSignaling server sends an answer message.
- SIG_TYPE: ANSWER
- This occurs when a peer sends an answer message is received.
Parameters:
-
message.typeStringMessage type
-
messageJSONThe message object received.
-
ridStringRoomId of the connected room.
-
sdpStringAnswer sessionDescription
-
midStringPeerId of the peer that is sending the enter shake.
-
typeStringThe type of message received.
-
_base64ToBlob
-
dataURL
Converts base64 string to raw binary data.
- Doesn't handle URLEncoded DataURIs
- See StackOverflow answer #6850276 for code that does this This is to convert the base64 binary string to a blob
Parameters:
-
dataURLStringBlob base64 dataurl.
_byeHandler
-
message
Triggers:
peerLeftSignaling server sends a bye message.
- SIG_TYPE: BYE
- This occurs when a peer left the room.
Parameters:
-
messageJSONThe message object received.
-
ridStringRoomId of the connected room.
-
midStringPeerId of the peer that has left the room.
-
typeStringThe type of message received.
-
_candidateHandler
-
message
Signaling server sends a candidate message.
- SIG_TYPE: CANDIDATE
- This occurs when a peer sends an ice candidate.
Parameters:
-
messageJSONThe message object received.
-
ridStringRoomId of the connected room.
-
midStringPeerId of the peer that is sending the offer shake.
-
sdpStringOffer sessionDescription.
-
targetStringPeerId that is specifically targeted to receive the message.
-
idStringPeer's ICE candidate id.
-
candidoateStringPeer's ICE candidate object.
-
labelStringPeer's ICE candidate label.
-
typeStringThe type of message received.
-
_chunkFile
-
blob -
blobByteSize
Chunks blob data into chunks.
Parameters:
-
blobBlobThe blob data to chunk.
-
blobByteSizeIntegerThe blob data size.
_clearDataChannelTimeout
-
peerId -
isSender -
self
Clears the datachannel timeout.
Parameters:
-
peerIdStringPeerId of the datachannel to clear timeout.
-
isSenderBooleanIs peer the sender or the receiver?
-
selfSkywaySkyway object.
_closeChannel
()
private
Closes the socket signaling connection.
_closeDataChannel
-
peerId
Closes the datachannel.
Parameters:
-
peerIdStringPeerId of the peer's datachannel to close.
_createDataChannel
-
peerId -
dc
Triggers:
dataChannelStateCreate a DataChannel. Only SCTPDataChannel support
Parameters:
-
peerIdStringPeerId of the peer which the datachannel is connected to
-
dcObjectThe datachannel object received.
_createPeerConnection
-
targetMid
Creates a peerconnection to communicate with the peer whose ID is 'targetMid'. All the peerconnection callbacks are set up here. This is a quite central piece.
Parameters:
-
targetMidString
Returns:
The created peer connection object.
_dataChannelACKHandler
-
peerId -
data
Triggers:
dataTransferStateThe user receives an acknowledge of the blob request.
Parameters:
-
peerIdStringPeerId of the peer that is sending the acknowledgement.
-
dataJSONThe data object received from datachannel.
-
ackNStringThe acknowledge request number.
- 0: Request accepted. First packet sent.
- 0 and above: Transfer is going on.
- -1: Request rejected.
-
senderStringThe sender's peerId.
-
typeStringThe type of datachannel message.
-
_dataChannelDATAHandler
-
peerId -
dataString -
dataType
Triggers:
dataTransferStateThis is when the data is sent from the sender to the receiving user.
Parameters:
-
peerIdStringPeerId of the peer that is sending the data.
-
dataStringArrayBuffer | Blob | StringThe data received.
-
dataTypeStringThe data type received from datachannel. [Rel: Skyway.DATA_TRANSFER_DATA_TYPE]
_dataChannelERRORHandler
-
peerId -
data
Triggers:
dataTransferStateThe user receives a timeout error.
Parameters:
-
peerIdStringPeerId of the peer that is sending the error.
-
dataArrayThe data object received from datachannel.
-
nameStringThe data name.
-
contentStringThe error message.
-
senderStringThe sender's peerId.
-
typeStringThe type of datachannel message.
-
_dataChannelERRORHandler
-
peerId -
data
Triggers:
dataTransferStateThe user receives a timeout error.
Parameters:
-
peerIdStringPeerId of the peer that is sending the error.
-
dataArrayThe data object received from datachannel.
-
nameStringThe data name.
-
contentStringThe error message.
-
isUploadErrorBooleanIs the error occurring at upload state.
-
senderStringThe sender's peerId.
-
typeStringThe type of datachannel message.
-
_dataChannelHandler
-
data
Handles all datachannel protocol events.
Parameters:
-
dataString | ObjectThe data received from datachannel.
_dataChannelMESSAGEHandler
-
peerId -
data
Triggers:
incomingMessageThe user receives a datachannel broadcast message.
Parameters:
-
peerIdStringPeerId of the peer that is sending a broadcast message.
-
dataJSONThe data object received from datachannel.
-
targetStringThe target peerId to receive the data.
-
dataString | JSONThe data to be received.
-
senderStringThe sender's peerId.
-
typeStringThe type of datachannel message.
-
_dataChannelWRQHandler
-
peerId -
data
Triggers:
dataTransferStateThe user receives a blob request. From here, it's up to the user to accept or reject it
Parameters:
-
peerIdStringPeerId of the peer that is sending the request.
-
dataJSONThe data object received from datachannel.
-
agentStringThe peer's browser agent.
-
versionIntegerThe peer's browser version.
-
nameStringThe data name.
-
sizeIntegerThe data size.
-
chunkSizeIntegerThe data chunk size expected to receive.
-
timeoutIntegerThe timeout to wait for packet response.
-
isPrivateBooleanIs the data sent private.
-
senderStringThe sender's peerId.
-
typeStringThe type of datachannel message.
-
_doAnswer
-
targetMid
We have succesfully received an offer and set it locally. This function will take care of cerating and sendng the corresponding answer. Handshake step 4.
Parameters:
-
targetMidStringPeerId of the peer to send answer to.
_doCall
-
targetMid -
peerBrowser
It then sends it to the peer. Handshake step 3 (offer) or 4 (answer)
Parameters:
-
targetMidStringPeerId of the peer to send offer to.
-
peerBrowserJSONThe peer browser information.
-
agentStringThe peer browser agent.
-
versionIntegerThe peer browser version.
-
_enterHandler
-
message
Triggers:
handshakeProgress, peerJoinedSignaling server sends a enter message.
- SIG_TYPE: ENTER
- This occurs when a peer just entered the room.
- If we don't have a connection with the peer, send a welcome.
Parameters:
-
messageJSONThe message object received.
-
ridStringRoomId of the connected room.
-
midStringPeerId of the peer that is sending the enter shake.
-
agentStringPeer's browser agent.
-
versionStringPeer's browser version.
-
userInfoStringPeer's user information.
-
settingsJSONPeer's stream settings -
settings.audioBoolean | JSON -
settings.audio.stereoBoolean -
settings.videoBoolean | JSON -
settings.video.resolutionJSON[Rel: Skyway.VIDEO_RESOLUTION] -
settings.video.resolution.widthInteger -
settings.video.resolution.heightInteger -
settings.video.frameRateInteger -
mediaStatusJSONPeer stream status. -
mediaStatus.audioMutedBooleanIf peer's audio stream is muted. -
mediaStatus.videoMutedBooleanIf peer's video stream is muted. -
userDataString | JSONPeer custom data.
-
-
typeStringThe type of message received.
-
_findSDPLine
-
sdpLines -
condition -
value
Finds a line in the SDP and returns it.
- To set the value to the line, add an additional parameter to the method.
Parameters:
-
sdpLinesArraySdp received.
-
conditionArrayThe conditions.
-
valueStringValue to set Sdplines to
Returns:
[index, line] - Returns the sdpLines based on the condition
_handleAV
-
mediaType -
enableMedia
Triggers:
peerUpdatedHandles all audio and video mute events.
- If there is no available audio or video stream, it will call leaveRoom() and call joinRoom() to join user in the room to send their audio and video stream.
Parameters:
-
mediaTypeStringMedia types expected to receive. [Rel: 'audio' or 'video']
-
enableMediaBooleanEnable it or disable it
_inRoomHandler
-
message
Triggers:
peerJoinedSignaling server sends an inRoom message.
- SIG_TYPE: IN_ROOM
- This occurs the user has joined the room.
Parameters:
-
messageJSONThe message object received.
-
ridStringRoomId of the connected room.
-
sidStringPeerId of self.
-
midStringPeerId of the peer that is sending the joinRoom message.
-
pc_configJSONThe peerconnection configuration.
-
typeStringThe type of message received.
-
_loadInfo
-
self
Triggers:
readyStateChangeStart the loading of information from the api server.
Parameters:
-
selfSkywaySkyway object.
_muteAudioEventHandler
-
message
Triggers:
peerUpdatedSignaling server sends a muteAudioEvent message.
- SIG_TYPE: MUTE_AUDIO
- This occurs when a peer's audio stream muted status has changed.
Parameters:
-
messageJSONThe message object received.
-
ridStringRoomId of the connected room.
-
midStringPeerId of the peer that is sending their own updated audio stream status.
-
mutedStringIf audio stream is muted or not.
-
typeStringThe type of message received.
-
_muteVideoEventHandler
-
message
Triggers:
peerUpdatedSignaling server sends a muteVideoEvent message.
- SIG_TYPE: MUTE_VIDEO
- This occurs when a peer's video stream muted status has changed.
Parameters:
-
messageJSONThe message object received.
-
ridStringRoomId of the connected room.
-
midStringPeerId of the peer that is sending their own updated video streams status.
-
mutedStringIf video stream is muted or not.
-
typeStringThe type of message received.
-
_offerHandler
-
message
Triggers:
handshakeProgressSignaling server sends an offer message.
- SIG_TYPE: OFFER
- This occurs when we've just received an offer.
- If there is no existing connection with this peer, create one, then set the remotedescription and answer.
Parameters:
-
messageJSONThe message object received.
-
ridStringRoomId of the connected room.
-
midStringPeerId of the peer that is sending the offer shake.
-
sdpStringOffer sessionDescription
-
typeStringThe type of message received.
-
_onIceCandidate
-
targetMid -
event
Triggers:
candidateGenerationStateA candidate has just been generated (ICE gathering) and will be sent to the peer. Part of connection establishment.
Parameters:
-
targetMidString -
eventEventThis is provided directly by the peerconnection API.
_onRemoteStreamAdded
-
targetMid -
event
Triggers:
incomingStreamThe remote peer advertised streams, that we are forwarding to the app. This is part of the peerConnection's addRemoteDescription() API's callback.
Parameters:
-
targetMidStringPeerId of the peer that has remote stream to send.
-
eventEventThis is provided directly by the peerconnection API.
_onUserMediaError
-
error
Triggers:
mediaAccessFailureAccess to user's MediaStream failed.
Parameters:
-
errorObjectError object that was thrown.
_onUserMediaSuccess
-
stream
Triggers:
mediaAccessSuccessAccess to user's MediaStream is successful.
Parameters:
-
streamMediaStreamMediaStream object.
_openChannel
()
private
Triggers:
channelMessage, channelOpen, channelError, channelCloseInitiate a socket signaling connection.
_openPeer
-
targetMid -
peerBrowser -
toOffer -
receiveOnly
We have a peer, this creates a peerconnection object to handle the call. if we are the initiator, we then starts the O/A handshake.
Parameters:
-
targetMidStringPeerId of the peer we should connect to.
-
peerBrowserJSONThe peer browser information.
-
agentStringThe peer browser agent.
-
versionIntegerThe peer browser version.
-
-
toOfferBooleanWether we should start the O/A or wait.
-
receiveOnlyBooleanShould they only receive?
_parseInfo
-
info -
self
Triggers:
readyStateChangeParse the information received from the api server.
Parameters:
-
infoJSONThe parsed information from the server.
-
selfSkywaySkyway object.
_parseStreamSettings
-
options
Parse stream settings
Parameters:
-
optionsJSONOptional. Media Constraints.
-
userDataJSONOptional. User custom data.
-
audioBoolean | JSONThis call requires audio
-
stereoBooleanEnabled stereo or not
-
-
videoBoolean | JSONThis call requires video
-
resolutionJSON[Rel: Skyway.VIDEO_RESOLUTION] -
resolution.widthIntegerVideo width -
resolution.heightIntegerVideo height -
frameRateIntegerMininum frameRate of Video
-
-
bandwidthStringBandwidth settings
-
audioStringAudio Bandwidth -
videoStringVideo Bandwidth -
dataStringData Bandwidth
-
-
_privateMessageHandler
-
message
Triggers:
privateMessageSignaling server sends a privateMessage message.
- SIG_TYPE: PRIVATE_MESSAGE
- This occurs when a peer sends private message to user.
Parameters:
-
messageJSONThe message object received.
-
dataJSON | StringThe data received.
-
ridStringRoomId of the connected room.
-
cidStringCredentialId of the room.
-
midStringPeerId of the peer that is sending a private broadcast message.
-
typeStringThe type of message received.
-
_processingSingleMessage
-
message
Handles the single signaling message received.
Parameters:
-
messageJSONThe message object received.
_processSigMessage
-
messageString
Handles everu incoming signaling message received.
- If it's a SIG_TYPE.GROUP message, break them down to single messages and let Skyway/_processSingleMessage:method to handle them.
Parameters:
-
messageStringStringThe message object stringified received.
_publicMessageHandler
-
message
Triggers:
publicMessageSignaling server sends a publicMessage message.
- SIG_TYPE: PUBLIC_MESSAGE
- This occurs when a peer broadcasts a public message to all connected peers.
Parameters:
-
messageJSONThe message object received.
-
dataJSON | StringThe data broadcasted
-
ridStringRoomId of the connected room.
-
cidStringCredentialId of the room.
-
midStringPeerId of the peer that is sending a private broadcast message.
-
typeStringThe type of message received.
-
_redirectHandler
-
message
Triggers:
systemActionSignaling server sends a redirect message.
- SIG_TYPE: REDIRECT
- This occurs when the signaling server is warning us or wanting to move us out when the peer sends too much messages at the same tme.
Parameters:
-
messageJSONThe message object received.
-
ridStringRoomId of the connected room.
-
urlStringDeprecated. Url to redirect user to.
-
infoStringThe reason for this action.
-
actionStringThe action to work on. [Rel: Skyway.SYSTEM_ACTION]
-
typeStringThe type of message received.
-
_reinit
-
options -
callback
Triggers:
readyStateChangeInitialize Skyway to retrieve new connection information bbasd on options.
Parameters:
-
optionsString | JSONConnection options or API Key ID
-
apiKeyStringAPI Key ID to identify with the Temasys backend server
-
defaultRoomStringOptional. The default room to connect to if there is no room provided in joinRoom().
-
roomServerStringOptional. Path to the Temasys backend server. If there's no room provided, default room would be used.
-
regionStringOptional. The regional server that user chooses to use. [Rel: Skyway.REGIONAL_SERVER]
-
iceTrickleBooleanOptional. The option to enable ICE trickle or not.
- Default is true.
-
dataChannelBooleanOptional. The option to enable datachannel or not.
- Default is true.
-
credentialsJSONOptional. Credentials options for setting a static meeting.
-
startDateTimeStringThe start timing of the meeting in date ISO String -
durationIntegerThe duration of the meeting -
credentialsStringThe credentials required to set the timing and duration of a meeting.
-
-
-
callbackFunctionThe callback fired once Skyway is re-initialized.
_removePeer
-
peerId
Triggers:
peerLeftActually clean the peerconnection and trigger an event. Can be called by _byHandler and leaveRoom.
Parameters:
-
peerIdStringPeerId of the peer that has left.
_requestServerInfo
-
method -
url -
callback -
params
Gets information from api server.
Parameters:
-
methodStringThe http method.
-
urlStringThe url to do a rest call.
-
callbackFunctionThe callback fired after Skyway receives a response from the api server.
-
paramsJSONHTTP Params
_roomLockEventHandler
-
message
Triggers:
roomLockSignaling server sends a roomLockEvent message.
- SIG_TYPE: ROOM_LOCK
- This occurs when a room lock status has changed.
Parameters:
-
messageJSONThe message object received.
-
ridStringRoomId of the connected room.
-
midStringPeerId of the peer that is sending the updated room lock status.
-
lockStringIf room is locked or not.
-
typeStringThe type of message received.
-
_sendBlobDataToPeer
-
data -
dataInfo -
targetPeerId
Sends blob data to individual peer.
- This sends the Skyway/WRQ:event and to initiate the TFTP protocol.
Parameters:
-
dataBlobThe blob data to be sent over.
-
dataInfoJSONThe data information.
-
transferIdStringTransferId of the data.
-
nameStringData name.
-
timeoutIntegerData timeout to wait for packets. [Default is 60].
-
sizeIntegerData size
-
-
targetPeerIdStringPeerId targeted to receive data. Leave blank to send to all peers.
_sendDataChannel
-
peerId -
data
Sends data to the datachannel.
Parameters:
-
peerIdStringPeerId of the peer's datachannel to send data.
-
dataJSONThe data to send.
_sendMessage
-
message
Sends a message to the signaling server.
- Not to be confused with method sendMessage() that broadcasts messages. This is for sending socket messages.
Parameters:
-
messageJSON
_setDataChannelTimeout
-
peerId -
timeout -
isSender
Sets the datachannel timeout.
- If timeout is met, it will send the 'ERROR' message
Parameters:
-
peerIdStringPeerId of the datachannel to set timeout.
-
timeoutIntegerThe timeout to set in seconds.
-
isSenderBooleanIs peer the sender or the receiver?
_setFirefoxIceServers
-
config
Sets the STUN server specially for Firefox for ICE Connection.
Parameters:
-
configJSONIce configuration servers url object.
Returns:
Updated configuration
_setLocalAndSendMessage
-
targetMid -
sessionDescription
Triggers:
handshakeProgressThis takes an offer or an aswer generated locally and set it in the peerconnection it then sends it to the peer. Handshake step 3 (offer) or 4 (answer)
Parameters:
-
targetMidStringPeerId of the peer to send offer/answer to.
-
sessionDescriptionJSONThis should be provided by the peerconnection API. User might 'tamper' with it, but then , the setLocal may fail.
_setSDPBitrate
-
sdpLines
Set Audio, Video and Data Bitrate in SDP
Parameters:
-
sdpLinesArraySdp received.
Returns:
Updated version with custom Bandwidth settings
_setStreams
-
options
Opens or closes existing MediaStreams.
Parameters:
-
optionsJSON-
audioJSONEnable audio or not
-
videoJSONEnable video or not
-
Returns:
Whether we should re-fetch mediaStreams or not
_trigger
-
eventName
Trigger all the callbacks associated with an event.
- Note that extra arguments can be passed to the callback which extra argument can be expected by callback is documented by each event.
Parameters:
-
eventNameStringThe Skyway event.
_updateUserEventHandler
-
message
Triggers:
peerUpdatedSignaling server sends a updateUserEvent message.
- SIG_TYPE: UPDATE_USER
- This occurs when a peer's custom user data is updated.
Parameters:
-
messageJSONThe message object received.
-
ridStringRoomId of the connected room.
-
midStringPeerId of the peer that is sending the updated event.
-
userDataJSON | StringThe peer's user data.
-
typeStringThe type of message received.
-
_waitForMediaStream
-
callback -
options
Waits for MediaStream.
- Once the stream is loaded, callback is called
- If there's not a need for stream, callback is called
Parameters:
-
callbackFunctionCallback after requested constraints are loaded.
-
optionsJSONOptional. Media Constraints.
-
userDataJSONOptional. User custom data.
-
audioBoolean | JSONThis call requires audio
-
stereoBooleanEnabled stereo or not
-
-
videoBoolean | JSONThis call requires video
-
resolutionJSON[Rel: Skyway.VIDEO_RESOLUTION] -
resolution.widthIntegerVideo width -
resolution.heightIntegerVideo height -
frameRateIntegerMininum frameRate of Video
-
-
bandwidthStringBandwidth settings
-
audioStringAudio Bandwidth -
videoStringVideo Bandwidth -
dataStringData Bandwidth
-
-
_welcomeHandler
-
message
Triggers:
handshakeProgress, peerJoinedSignaling server sends a welcome message.
- SIG_TYPE: WELCOME
- This occurs when we've just received a welcome.
- If there is no existing connection with this peer, create one, then set the remotedescription and answer.
Parameters:
-
messageJSONThe message object received.
-
ridStringRoomId of the connected room.
-
midStringPeerId of the peer that is sending the welcome shake.
-
receiveOnlyBooleanPeer to receive only
-
enableIceTrickleBooleanOption to enable Ice trickle or not
-
enableDataChannelBooleanOption to enable DataChannel or not
-
userInfoJSONPeer Skyway._user.info data.
-
settingsJSONPeer stream settings -
settings.audioBoolean | JSON -
settings.audio.stereoBoolean -
settings.videoBoolean | JSON -
settings.video.resolutionJSON[Rel: Skyway.VIDEO_RESOLUTION] -
settings.video.resolution.widthInteger -
settings.video.resolution.heightInteger -
settings.video.frameRateInteger -
mediaStatusJSONPeer stream status. -
mediaStatus.audioMutedBooleanIf Peer's Audio stream is muted. -
mediaStatus.videoMutedBooleanIf Peer's Video stream is muted. -
userDataString | JSONPeer custom data
-
-
agentStringBrowser agent.
-
versionStringBrowser version.
-
targetStringPeerId of the peer targeted to receieve this message.
-
restartNegoBooleanRestart negotiation for "welcome".
-
hsPriorityIntegerThe priority of the user to send first.
-
typeStringThe type of message received.
-
cancelBlobTransfer
-
peerId -
transferType
Triggers:
dataTransferStateReject file transfer for cancel.
Parameters:
-
peerIdStringPeerId of the peer that is expected to receive the request response.
-
transferTypeStringTransfer type [Rel: DATA_TRANSFER_TYPE]
disableAudio
()
Triggers:
peerUpdatedDisable microphone.
- If microphone is not enabled from the beginning, there is no effect.
Example:
SkywayDemo.disableAudio();
disableVideo
()
Triggers:
peerUpdatedDisable webcam video.
- If webcam is not enabled from the beginning, there is no effect.
- Note that in a Chrome-to-chrome session, each party's peer audio may appear muted in when the audio is muted.
- You may follow up the bug on here.
Example:
SkywayDemo.disableVideo();
enableAudio
()
Triggers:
peerUpdatedEnable microphone.
- If microphone is not enabled from the beginning, user would have to reinitate the joinRoom() process and ask for microphone again.
Example:
SkywayDemo.enableAudio();
enableVideo
()
Triggers:
peerUpdatedEnable webcam video.
- If webcam is not enabled from the beginning, user would have to reinitate the joinRoom() process and ask for webcam again.
Example:
SkywayDemo.enableVideo();
getPeerInfo
-
peerId
Gets the peer information.
- If input peerId is user's id or empty, getPeerInfo() would return user's peer information.
Parameters:
-
peerIdStringPeerId of the peer information to retrieve.
Returns:
Peer information.
Example:
// Example 1: To get other peer's information
var peerInfo = SkywayDemo.getPeerInfo(peerId);
// Example 2: To get own information
var userInfo = SkywayDemo.getPeerInfo();
getUserData
()
JSON | String
Gets the user custom data.
Returns:
User custom data.
Example:
var userInfo = SkywayDemo.getUserData();
getUserMedia
-
options
Triggers:
mediaAccessSuccess, mediaAccessErrorGets the default webcam and microphone.
- Please do not be confused with the MediaStreamConstraints specified in the original w3c specs.
- This is an implemented function for Skyway.
Parameters:
-
optionsJSONOptional. MediaStream constraints.
-
audioJSON | BooleanOption to allow audio stream.
-
stereoBooleanOption to enable stereo during call.
-
-
videoJSON | BooleanOption to allow video stream.
-
resolutionJSONThe resolution of video stream. - Check out VIDEO_RESOLUTION. -
resolution.width!~YUIDOC_LINE~!IntegerThe video stream resolution width. -
resolution.height!~YUIDOC_LINE~!IntegerThe video stream resolution height. -
frameRate!~YUIDOC_LINE~!IntegerThe video stream mininum frameRate.
-
-
Example:
// Default is to get both audio and video
// Example 1: Get both audio and video by default.
SkywayDemo.getUserMedia();
// Example 2: Get the audio stream only
SkywayDemo.getUserMedia({
'video' : false,
'audio' : true
});
// Example 3: Set the stream settings for the audio and video
SkywayDemo.getUserMedia({
'video' : {
'resolution': SkywayDemo.VIDEO_RESOLUTION.HD,
'frameRate': 50
},
'audio' : {
'stereo': true
}
});
init
-
options
Triggers:
readyStateChangeIntiailize Skyway to retrieve connection information.
- IMPORTANT: Please call this method to load all server information before joining the room or doing anything else.
- If you would like to set the start time and duration of the room,
you have to generate the credentials. In example 3, we use the
CryptoJS library.
- Step 1: Generate the hash. It is created by using the roomname, duration and the timestamp (in ISO String format).
- Step 2: Generate the Credentials. It is is generated by converting the hash to a Base64 string and then encoding it to a URI string.
- Step 3: Initialize Skyway
Parameters:
-
optionsString | JSONConnection options or API Key ID
-
apiKeyStringAPI Key ID to identify with the Temasys backend server
-
defaultRoomStringOptional. The default room to connect to if there is no room provided in joinRoom().
-
roomServerStringOptional. Path to the Temasys backend server. If there's no room provided, default room would be used.
-
regionStringOptional. The regional server that user chooses to use. [Rel: Skyway.REGIONAL_SERVER]
-
iceTrickleBooleanOptional. The option to enable ICE trickle or not.
- Default is true.
-
dataChannelBooleanOptional. The option to enable datachannel or not.
- Default is true.
-
credentialsJSONOptional. Credentials options for setting a static meeting.
-
startDateTimeStringThe start timing of the meeting in Date ISO String -
durationIntegerThe duration of the meeting -
credentialsStringThe credentials required to set the timing and duration of a meeting.
-
-
Example:
// Note: Default room is apiKey when no room
// Example 1: To initalize without setting any default room.
SkywayDemo.init('apiKey');
// Example 2: To initialize with apikey, roomServer and defaultRoom
SkywayDemo.init({
'apiKey' : 'apiKey',
'roomServer' : 'http://xxxx.com',
'defaultRoom' : 'mainHangout'
});
// Example 3: To initialize with credentials to set startDateTime and
// duration of the room
var hash = CryptoJS.HmacSHA1(roomname + '' + duration + '' +
(new Date()).toISOString(), token);
var credentials = encodeURIComponent(hash.toString(CryptoJS.enc.Base64));
SkywayDemo.init({
'apiKey' : 'apiKey',
'roomServer' : 'http://xxxx.com',
'defaultRoom' : 'mainHangout'
'credentials' : {
'startDateTime' : (new Date()).toISOString(),
'duration' : 500,
'credentials' : credentials
}
});
joinRoom
-
room -
options
Triggers:
peerJoinedUser to join the room.
- You may call getUserMedia() first if you want to get MediaStream and joining Room seperately.
- If joinRoom() parameters is empty, it simply uses any previous media or user data settings.
- If no room is specified, user would be joining the default room.
Parameters:
-
roomStringOptional. Room to join user in.
-
optionsJSONOptional. Media Constraints.
-
userDataJSON | StringOptional. User custom data.
-
audioBoolean | JSONThis call requires audio stream.
-
stereoBooleanOption to enable stereo during call.
-
-
videoBoolean | JSONThis call requires video stream.
-
resolutionJSONThe resolution of video stream. [Rel: Skyway.VIDEO_RESOLUTION] -
resolution.width!~YUIDOC_LINE~!IntegerThe video stream resolution width. -
resolution.height!~YUIDOC_LINE~!IntegerThe video stream resolution height. -
frameRate!~YUIDOC_LINE~!IntegerThe video stream mininum frameRate.
-
-
bandwidthJSONStream bandwidth settings.
-
audioIntegerAudio stream bandwidth in kbps. - Recommended: 50 kbps. -
videoIntegerVideo stream bandwidth in kbps. - Recommended: 256 kbps. -
dataIntegerData stream bandwidth in kbps. - Recommended: 1638400 kbps.
-
-
Example:
// To just join the default room without any video or audio
// Note that calling joinRoom without any parameters
// Still sends any available existing MediaStreams allowed.
// See Examples 2, 3, 4 and 5 etc to prevent video or audio stream
SkywayDemo.joinRoom();
// To just join the default room with bandwidth settings
SkywayDemo.joinRoom({
'bandwidth': {
'data': 14440
}
});
// Example 1: To call getUserMedia and joinRoom seperately
SkywayDemo.getUserMedia();
SkywayDemo.on('mediaAccessSuccess', function (stream)) {
attachMediaStream($('.localVideo')[0], stream);
SkywayDemo.joinRoom();
});
// Example 2: Join a room without any video or audio
SkywayDemo.joinRoom('room');
// Example 3: Join a room with audio only
SkywayDemo.joinRoom('room', {
'audio' : true,
'video' : false
});
// Example 4: Join a room with prefixed video width and height settings
SkywayDemo.joinRoom('room', {
'audio' : true,
'video' : {
'resolution' : {
'width' : 640,
'height' : 320
}
}
});
// Example 5: Join a room with userData and settings with audio, video
// and bandwidth
SkwayDemo.joinRoom({
'userData': {
'item1': 'My custom data',
'item2': 'Put whatever, string or JSON or array'
},
'audio' : {
'stereo' : true
},
'video' : {
'res' : SkywayDemo.VIDEO_RESOLUTION.VGA,
'frameRate' : 50
},
'bandwidth' : {
'audio' : 48,
'video' : 256,
'data' : 14480
}
});
leaveRoom
()
Triggers:
peerLeft, channelCloseUser to leave the room.
Example:
SkywayDemo.leaveRoom();
lockRoom
()
Triggers:
lockRoomLock the room to prevent peers from joining the room.
Example:
SkywayDemo.lockRoom();
off
-
eventName -
callback
To unregister a callback function from an event.
Parameters:
-
eventNameStringThe Skyway event.
-
callbackFunctionThe callback fired after the event is triggered.
Example:
SkywayDemo.off('peerJoined', callback);
on
-
eventName -
callback
To register a callback function to an event.
Parameters:
-
eventNameStringThe Skyway event.
-
callbackFunctionThe callback fired after the event is triggered.
Example:
SkywayDemo.on('peerJoined', function (peerId, peerInfo) {
console.info(peerId + ' has joined the room');
console.log('Peer information are:');
console.info(peerInfo);
});
respondBlobRequest
-
peerId -
accept
Triggers:
dataTransferStateUser's response to accept or reject data transfer request.
Parameters:
-
peerIdStringPeerId of the peer that is expected to receive the request response.
-
acceptBooleanThe response of the user to accept the data transfer or not.
sendBlobData
-
data -
dataInfo -
targetPeerId
Triggers:
dataTransferStateStart a data transfer with peer(s).
- Note that peers have the option to download or reject receiving the blob data.
- This method is ideal for sending files.
- To send a private file to a peer, input the peerId after the data information.
Parameters:
-
dataObjectThe data to be sent over. Data has to be a blob.
-
dataInfoJSONThe data information.
-
transferIdStringtransferId of the data.
-
nameStringData name.
-
timeoutIntegerThe timeout to wait for packets. [Default is 60].
-
sizeIntegerThe data size
-
-
targetPeerIdStringPeerId targeted to receive data. Leave blank to send to all peers.
Example:
// Send file to all peers connected
SkywayDemo.sendBlobData(file, 67);
// Send file to individual peer
SkywayDemo.sendBlobData(blob, 87, targetPeerId);
sendMessage
-
message -
targetPeerId
Triggers:
incomingMessageBroadcast a message to all peers.
- WARNING: Map arrays data would be lost when stringified in JSON, so refrain from using map arrays.
Parameters:
-
messageString | JSONThe message data to send.
-
targetPeerIdStringPeerId of the peer to send a private message data to.
Example:
// Example 1: Send to all peers
SkywayDemo.sendMessage('Hi there!');
// Example 2: Send to a targeted peer
SkywayDemo.sendMessage('Hi there peer!', targetPeerId);
sendP2PMessage
-
message -
targetPeerId
Triggers:
incomingMessageBroadcasts to all P2P datachannel messages and sends to a peer only when targetPeerId is provided.
- This is ideal for sending strings or json objects lesser than 16KB as noted in here.
- For huge data, please check out function sendBlobData().
- WARNING: Map arrays data would be lost when stringified in JSON, so refrain from using map arrays.
Parameters:
-
messageString | JSONThe message data to send.
-
targetPeerIdStringOptional. Provide if you want to send to only one peer
Example:
// Example 1: Send to all peers
SkywayDemo.sendP2PMessage('Hi there! This is from a DataChannel!');
// Example 2: Send to specific peer
SkywayDemo.sendP2PMessage('Hi there peer! This is from a DataChannel!', targetPeerId);
setUserData
-
userData
Triggers:
peerUpdatedUpdates the user custom data.
- Please note that the custom data would be overrided so please call getUserData() and then modify the information you want individually.
- peerUpdated only fires after setUserData() is fired. after the user joins the room.
Parameters:
-
userDataJSON | StringUser custom data.
Example:
// Example 1: Intial way of setting data before user joins the room
SkywayDemo.setUserData({
displayName: 'Bobby Rays',
fbUserId: 'blah'
});
// Example 2: Way of setting data after user joins the room
var userData = SkywayDemo.getUserData();
userData.displayName = 'New Name';
userData.fbUserId = 'another Id';
SkywayDemo.setUserData(userData);
unlockRoom
()
Triggers:
lockRoomUnlock the room to allow peers to join the room.
Example:
SkywayDemo.unlockRoom();
Attributes
_defaultRoom
String
private
The default room that the user connects to if no room is provided in joinRoom().
_enableDataChannel
Boolean
private
required
The current state if datachannel is enabled.
Default: true
_enableIceTrickle
Boolean
private
required
The current state if ICE trickle is enabled.
Default: true
_mozChunkFileSize
Integer
private
final
required
The fixed for each data chunk for firefox implementation.
- Firefox the sender chunks 49152 but receives as 16384.
_path
String
private
final
required
The path that user is currently connect to.
- NOTE ALEX: check if last char is '/'
Default: _serverPath
_readyState
Integer
private
required
The current Skyway ready state change. [Rel: Skyway.READY_STATE_CHANGE]
_room
JSON
private
required
The room connection information.
Keys:
-
roomJSONRoom information and credentials.
-
idStringRoomId of the room user is connected to.
-
tokenStringToken of the room user is connected to.
-
tokenTimestampStringToken timestamp of the room user is connected to.
-
signalingServerJSONThe signaling server settings the room has to connect to.
-
protocolStringThe protocol the room has to use. -
ipStringThe ip address of the signaling server the room has to connect to. -
portStringThe port that the room & has to connec to.
-
-
pcHelperJSONHolder for all the constraints objects used in a peerconnection lifetime. Some are initialized by default, some are initialized by internal methods, all can be overriden through updateUser. Future APIs will help user modifying specific parts (audio only, video only, ...) separately without knowing the intricacies of constraints.
-
pcConstraintsJSONThe peer connection constraints object. -
pcConfigJSONWill be provided upon connection to a room -
pcConfig.mandatoryJSONMandantory options. -
pcConfig.optionalArrayOptional options. - Ex: [{DtlsSrtpKeyAgreement: true}] -
offerConstraintsJSONThe offer constraints object. -
offerConstraints.mandatoryJSONOffer mandantory object. - Ex: {MozDontOfferDataChannel:true} -
offerConstraints.optionalArrayOffer optional object. -
sdpConstraintsJSONSdp constraints object -
sdpConstraints.mandatoryJSONSdp mandantory object. - Ex: { 'OfferToReceiveAudio':true, 'OfferToReceiveVideo':true } -
sdpConstraints.optionalArraySdp optional object.
-
-
_roomCredentials
String
private
optional
The credentials required to set the start date and time and the duration.
_roomServer
String
private
The server that user connects to to make api calls to.
- The reason why users can input this value is to give users the chance to connect to any of our beta servers if available instead of the stable version.
_roomStart
String
private
optional
The static room's meeting starting date and time.
- The value is in ISO formatted string.
_selectedRoom
String
private
The room that the user is currently connected to.
Default: _defaultRoom
_streamSettings
JSON
private
The user stream settings.
- By default, all is false.
Default: { 'audio' : false, 'video' : false }
_user
JSON
private
required
User information, credential and the local stream(s).
Keys:
-
idStringUser's session id.
-
sidStringUser's secret id. This is the id used as the peerId.
-
apiOwnerStringOwner of the room.
-
streamsArrayThe array of user's MediaStream(s).
-
timestampStringUser's timestamp.
-
tokenStringUser access token.
-
infoJSONOptional. User information object.
-
settingsJSONUser stream settings.
-
audioBoolean | JSONUser audio settings. -
audio.stereoBooleanUser has enabled stereo or not. -
videoBoolean | JSONUser video settings. -
video.resolutionBolean | JSONUser video resolution set. [Rel: Skyway.VIDEO_RESOLUTION] -
video.resolution.widthIntegerUser video resolution width. -
video.resolution.heightIntegerUser video resolution height. -
video.frameRateIntegerUser video minimum frame rate.
-
-
mediaStatusJSONUser MediaStream(s) status.
-
audioMutedBooleanIs user's audio muted. -
videoMutedBooleanIs user's vide muted.
-
-
userDataString | JSONUser's custom data set.
-
CANDIDATE_GENERATION_STATE
JSON
readonly
The list of ICE candidate generation states.
- Check out the w3 specification documentation.
- This is RTCIceGatheringState of the peer.
- The states that would occur are:
Keys:
-
NEWStringThe object was just created, and no networking has occurred yet.
-
GATHERINGStringThe ICE engine is in the process of gathering candidates for this RTCPeerConnection.
-
COMPLETEDStringThe ICE engine has completed gathering. Events such as adding a new interface or a new TURN server will cause the state to go back to gathering.
DATA_CHANNEL_STATE
JSON
readonly
The list of datachannel states.
- Check out the w3 specification documentation.
- This is the RTCDataChannelState of the peer.
- ERROR is an additional implemented state by Skyway for further error tracking.
- The states that would occur are:
Keys:
-
CONNECTINGStringThe user agent is attempting to establish the underlying data transport. This is the initial state of a RTCDataChannel object created with createDataChannel().
-
OPENStringThe underlying data transport is established and communication is possible. This is the initial state of a RTCDataChannel object dispatched as a part of a RTCDataChannelEvent.
-
CLOSINGStringThe procedure to close down the underlying data transport has started.
-
CLOSEDStringThe underlying data transport has been closed or could not be established.
-
ERRORStringDatachannel has occurred an error.
DATA_TRANSFER_DATA_TYPE
JSON
readonly
The list of data transfer data types.
- TODO: ArrayBuffer and Blob data transfer in datachannel.
- The available data transfer data types are:
Keys:
-
BINARY_STRINGStringBinaryString data type.
-
ARRAY_BUFFERStringStill-implementing. ArrayBuffer data type.
-
BLOBStringStill-implementing. Blob data type.
DATA_TRANSFER_STATE
JSON
readonly
The list of datachannel transfer state.
- These are the states to inform the state of the data transfer.
- The list of states would occur are:
Keys:
-
UPLOAD_REQUESTStringPeer has a data transfer request.
-
UPLOAD_STARTEDStringData transfer of upload has just started.
-
DOWNLOAD_STARTEDStringData transfer of download has just started.
-
UPLOADINGStringData upload transfer is occurring.
-
DOWNLOADINGStringData download transfer is occurring.
-
UPLOAD_COMPLETEDStringData upload transfer has been completed.
-
DOWNLOAD_COMPLETEDStringData download transfer has been completed.
-
REJECTEDStringPeer rejected user's data transfer request.
-
ERRORStringData transfer had an error occurred when uploading or downloading file.
DATA_TRANSFER_TYPE
JSON
readonly
The list of datachannel transfer types.
- This is used to identify if the stream is an upload stream or a download stream.
- The available types are:
Keys:
-
UPLOADStringThe datachannel transfer is an upload stream.
-
DOWNLOADStringThe datachannel transfer is a download stream.
DC_TYPE
JSON
private
readonly
The list of datachannel message types.
- These are the list of available datachannel message types expected to be received.
- These message types are fixed.
- The available message types are:
Keys:
-
WRQ!~YUIDOC_LINE~!-StringSend: User request to transfer a data.
- Received: A peer has requested to transfer a data.
-
ACK!~YUIDOC_LINE~!-StringSend: User response to data transfer request.
- Received: Response from peer towards data transfer.
- -1: Peer has rejected data transfer request.
- 0: Peer has accepted data transfer request.
0: Data transfer is going on.
- Received: Response from peer towards data transfer.
-
CANCEL!~YUIDOC_LINE~!-StringSend: User canceled data transfer.
- Received: A peer has canceled data transfer.
-
ERROR!~YUIDOC_LINE~!-StringSend: Timeout waiting for peer response has exceeded limit.
- Received: Response from peer that timeout has reached its limit. Data transfer has failed.
-
MESSAGE!~YUIDOC_LINE~!-StringSend: User sends a P2P message.
- Received: A peer has sent a P2P message.
HANDSHAKE_PROGRESS
JSON
readonly
The list of handshake progress steps.
- This are the list of steps for the Skyway peer connection.
- The steps that would occur are:
Keys:
-
ENTERStringStep 1. Received "enter" from peer.
-
WELCOMEStringStep 2. Received "welcome" from peer.
-
OFFERStringStep 3. Received "offer" from peer.
-
ANSWERStringStep 4. Received "answer" from peer.
-
ERRORStringError state.
ICE_CONNECTION_STATE
JSON
readonly
The list of ICE connection states.
- Check out the w3 specification documentation.
- This is the RTCIceConnection state of the peer.
- The states that would occur are:
Keys:
-
STARTINGStringThe ICE agent is gathering addresses and/or waiting for remote candidates to be supplied.
-
CHECKINGStringThe ICE agent has received remote candidates on at least one component, and is checking candidate pairs but has not yet found a connection. In addition to checking, it may also still be gathering.
-
CONNECTEDStringThe ICE agent has found a usable connection for all components but is still checking other candidate pairs to see if there is a better connection. It may also still be gathering.
-
COMPLETEDStringThe ICE agent has finished gathering and checking and found a connection for all components.
-
FAILEDStringThe ICE agent is finished checking all candidate pairs and failed to find a connection for at least one component.
-
DISCONNECTEDStringLiveness checks have failed for one or more components. This is more aggressive than "failed", and may trigger intermittently (and resolve itself without action) on a flaky network.
-
CLOSEDStringThe ICE agent has shut down and is no longer responding to STUN requests.
PEER_CONNECTION_STATE
JSON
readonly
The list of peer connection states.
- Check out the w3 specification documentation.
- This is the RTCSignalingState of the peer.
- The states that would occur are:
Keys:
-
STABLEStringThere is no offer/answer exchange in progress. This is also the initial state in which case the local and remote descriptions are empty.
-
HAVE_LOCAL_OFFERStringA local description, of type "offer", has been successfully applied.
-
HAVE_REMOTE_OFFERStringA remote description, of type "offer", has been successfully applied.
-
HAVE_LOCAL_PRANSWERStringA remote description of type "offer" has been successfully applied and a local description of type "pranswer" has been successfully applied.
-
HAVE_REMOTE_PRANSWERStringA local description of type "offer" has been successfully applied and a remote description of type "pranswer" has been successfully applied.
-
CLOSEDStringThe connection is closed.
READY_STATE_CHANGE
JSON
readonly
The list of api server data retrieval state.
- These are the states to inform the state of retrieving the information from the api server required to start the peer connection or if the browser is eligible to start the peer connection.
- This is the first event that would fired, because Skyway would retrieve information from the api server that is required to start the connection.
- Once the state is COMPLETED, Skyway is ready to start the call.
- The states that would occur are:
Keys:
-
INITIntegerSkyway has just started. No information are retrieved yet.
-
LOADINGIntegerSkyway is starting the retrieval of the connection information.
-
COMPLETEDIntegerSkyway has completed retrieving the connection.
-
ERRORIntegerSkyway has occurred an error when retrieving the connection information.
READY_STATE_CHANGE_ERROR
JSON
readonly
The list of ready state change errors.
- These are the error states from the error object error code.
- The states that would occur are:
Keys:
-
API_INVALIDIntegerApi Key provided does not exist.
-
API_DOMAIN_NOT_MATCHIntegerApi Key used in domain does not match.
-
API_CORS_DOMAIN_NOT_MATCHIntegerApi Key used in CORS domain does not match.
-
API_CREDENTIALS_INVALIDIntegerApi Key credentials does not exist.
-
API_CREDENTIALS_NOT_MATCHIntegerApi Key credentials does not match what is expected.
-
API_INVALID_PARENT_KEYIntegerApi Key does not have a parent key nor is a root key.
-
API_NOT_ENOUGH_CREDITIntegerApi Key does not have enough credits to use.
-
API_NOT_ENOUGH_PREPAID_CREDITIntegerApi Key does not have enough prepaid credits to use.
-
API_FAILED_FINDING_PREPAID_CREDITIntegerApi Key preapid payments does not exist.
-
API_NO_MEETING_RECORD_FOUNDIntegerApi Key does not have a meeting record at this timing. This occurs when Api Key is a static one.
-
ROOM_LOCKEDIntegerRoom is locked.
-
NO_SOCKET_IOIntegerNo socket.io dependency is loaded to use.
-
NO_XMLHTTPREQUEST_SUPPORTIntegerBrowser does not support XMLHttpRequest to use.
-
NO_WEBRTC_SUPPORTIntegerBrowser does not have WebRTC support.
-
NO_PATHIntegerNo path is loaded yet.
-
INVALID_XMLHTTPREQUEST_STATUSIntegerInvalid XMLHttpRequest when retrieving information.
REGIONAL_SERVER
JSON
readonly
The list of available regional servers.
- This is for developers to set the nearest region server for Skyway to connect to for faster connectivity.
- The available regional servers are:
Keys:
-
APAC1StringAsia pacific server 1.
-
US1Stringserver 1.
SIG_TYPE
JSON
private
readonly
The list of signaling message types.
- These are the list of available signaling message types expected to be received.
- These message types are fixed.
- The available message types are:
Keys:
-
JOIN_ROOM!~YUIDOC_LINE~!-StringSend: User request to join the room.
-
IN_ROOM!~YUIDOC_LINE~!-StringReceived: Response from server that user has joined the room.
-
ENTER!~YUIDOC_LINE~!-StringSend: Broadcast message to inform other connected peers in the room that the user is the new peer joining the room.
- Received: A peer has just joined the room. To send a welcome message.
-
WELCOME!~YUIDOC_LINE~!-StringSend: Respond to user to request peer to create the offer.
- Received: Response from peer that peer acknowledges the user has joined the room. To send and create an offer message.
-
OFFER!~YUIDOC_LINE~!-StringSend: Respond to peer's request to create an offer.
- Received: Response from peer's offer message. User to create and send an answer message.
-
ANSWER!~YUIDOC_LINE~!-StringSend: Response to peer's offer message.
- Received: Response from peer's answer message. Connection is established.
-
CANDIDATE!~YUIDOC_LINE~!-StringSend: User to send the ICE candidate after onicecandidate is called.
- Received: User to add peer's ice candidate in addIceCandidate.
-
BYE!~YUIDOC_LINE~!-StringReceived: Peer has left the room.
-
CHAT!~YUIDOC_LINE~!-StringSend: Deprecated. User sends a chat message.
- Received: Deprecated. Peer sends a chat message to user.
-
REDIRECT!~YUIDOC_LINE~!-StringReceived: Server warning to user.
-
ERROR!~YUIDOC_LINE~!-StringReceived: Deprecated. Server error occurred.
-
UPDATE_USER!~YUIDOC_LINE~!-StringSend: User's custom data is updated and to inform other peers of updated custom data.
- Received: Peer's user custom data has changed.
-
ROOM_LOCK!~YUIDOC_LINE~!-StringSend: Room lock action has changed and to inform other peers of updated room lock status.
- Received: Room lock status has changed.
-
MUTE_VIDEO!~YUIDOC_LINE~!-StringSend: User has muted video and to inform other peers of updated muted video stream status.
- Received: Peer muted video status has changed.
-
MUTE_AUDIO!~YUIDOC_LINE~!-StringSend: User has muted audio and to inform other peers of updated muted audio stream status.
- Received: Peer muted audio status has changed.
-
PUBLIC_MESSAGE!~YUIDOC_LINE~!-StringSend: User sends a broadcast message to all peers.
- Received: User receives a peer's broadcast message.
-
PRIVATE_MESSAGE!~YUIDOC_LINE~!-StringSend: User sends a private message to a peer.
- Received: User receives a private message from a peer.
SYSTEM_ACTION
JSON
readonly
The list of signaling actions received.
- These are usually received from the signaling server to warn the user.
- The system action outcomes are:
Keys:
-
WARNINGStringServer is warning user that the room is closing.
-
REJECTStringServer has rejected user from room.
-
CLOSEDStringServer has closed the room.
VIDEO_RESOLUTION
JSON
readonly
The list of recommended video resolutions.
- Note that the higher the resolution, the connectivity speed might be affected.
- The available video resolutions type are:
Keys:
-
QVGAJSONQVGA video resolution.
-
widthInteger320
-
heightInteger180
-
-
VGAJSONVGA video resolution.
-
widthInteger640
-
heightInteger360
-
-
HDJSONHD video quality
-
widthInteger1280
-
heightInteger720
-
-
FHDJSONMight not be supported. Full HD video resolution.
-
widthInteger1920
-
heightInteger1080
-
Events
candidateGenerationState
Event fired when an ICE gathering state has changed.
Event Payload:
-
stateStringThe ice candidate generation state. [Rel: Skyway.CANDIDATE_GENERATION_STATE]
-
peerIdStringPeerId of the peer that had an ice candidate generation state change.
channelClose
Event fired when the socket connection to the signaling server has closed.
channelError
Event fired when the socket connection has occurred an error.
Event Payload:
-
errorObject | StringError message or object thrown.
channelMessage
Event fired when the socket connection received a message from the signaling server.
Event Payload:
-
messageJSON
channelOpen
Event fired when the socket connection to the signaling server is open.
dataChannelState
Event fired when a peer's datachannel state has changed.
Event Payload:
-
stateStringThe datachannel state. [Rel: Skyway.DATA_CHANNEL_STATE]
-
peerIdStringPeerId of peer that has a datachannel state change.
dataTransferState
Event fired when a data transfer state has changed.
- Note that transferInfo.data sends the blob data, and no longer a blob url.
Event Payload:
-
stateStringThe data transfer state. [Rel: Skyway.DATA_TRANSFER_STATE]
-
transferIdStringTransferId of the data.
-
peerIdStringPeerId of the peer that has a data transfer state change.
-
transferInfoJSONData transfer information.
-
percentageJSONThe percetange of data being uploaded / downloaded.
-
senderPeerIdJSONPeerId of the sender.
-
dataJSONThe blob data. See the createObjectURL method on how you can convert the blob to a download link.
-
nameJSONData name.
-
sizeJSONData size.
-
-
errorJSONThe error object.
-
messageStringError message thrown.
-
transferTypeStringIs error from uploading or downloading. [Rel: Skyway.DATA_TRANSFER_TYPE]
-
handshakeProgress
Event fired when a peer's handshake progress has changed.
Event Payload:
-
stepStringThe handshake progress step. [Rel: Skyway.HANDSHAKE_PROGRESS]
-
peerIdStringPeerId of the peer's handshake progress.
-
errorObject | StringError message or object thrown.
incomingMessage
Event fired when a message being broadcasted is received.
- This is changed from chatMessageReceived, privateMessage and publicMessage event.
- Note that chatMessageReceived, privateMessage and publicMessage is removed from the specs.
Event Payload:
-
messageJSONMessage object that is received.
-
contentJSON | StringData that is broadcasted.
-
senderPeerIdStringPeerId of the sender peer.
-
targetPeerIdStringPeerId that is specifically targeted to receive the message.
-
isPrivateBooleanIs data received a private message.
-
isDataChannelBooleanIs data received from a data channel.
-
-
peerIdStringPeerId of the sender peer.
-
peerInfoJSONPeer's information.
-
settingsJSONPeer's stream settings.
-
audioBoolean | JSONPeer's audio stream settings. -
audio.stereoBooleanIf peer has stereo enabled or not. -
videoBoolean | JSONPeer's video stream settings. -
video.resolution!~YUIDOC_LINE~!JSONPeer's video stream resolution [Rel: Skyway.VIDEO_RESOLUTION] -
video.resolution.width!~YUIDOC_LINE~!IntegerPeer's video stream resolution width. -
video.resolution.height!~YUIDOC_LINE~!IntegerPeer's video stream resolution height. -
video.frameRate!~YUIDOC_LINE~!IntegerPeer's video stream resolution minimum frame rate.
-
-
mediaStatusJSONPeer stream status.
-
audioMutedBooleanIf peer's audio stream is muted. -
videoMutedBooleanIf peer's video stream is muted.
-
-
userDataJSON | StringPeer's custom user data.
-
-
isSelfBooleanIs the peer self.
incomingStream
Event fired when a remote stream has become available.
- This occurs after the user joins the room.
- This is changed from addPeerStream event.
- Note that addPeerStream is removed from the specs.
Event Payload:
-
peerIdStringPeerId of the peer that is sending the stream.
-
streamObjectMediaStream object.
-
isSelfBooleanIs the peer self.
mediaAccessError
Event fired when webcam or microphone media access fails.
Event Payload:
-
errorObject | StringError object thrown.
mediaAccessSuccess
Event fired when webcam or microphone media acces passes.
Event Payload:
-
streamObjectMediaStream object.
peerConnectionState
Event fired when a peer Connection state has changed.
Event Payload:
-
stateStringThe peer connection state. [Rel: Skyway.PEER_CONNECTION_STATE]
-
peerIdStringPeerId of the peer that had a peer connection state change.
peerJoined
Event fired when a peer joins the room.
Event Payload:
-
peerIdStringPeerId of the peer that joined the room.
-
peerInfoJSONPeer's information.
-
settingsJSONPeer's stream settings.
-
audioBoolean | JSONPeer's audio stream settings. -
audio.stereoBooleanIf peer has stereo enabled or not. -
videoBoolean | JSONPeer's video stream settings. -
video.resolution!~YUIDOC_LINE~!JSONPeer's video stream resolution [Rel: Skyway.VIDEO_RESOLUTION] -
video.resolution.width!~YUIDOC_LINE~!IntegerPeer's video stream resolution width. -
video.resolution.height!~YUIDOC_LINE~!IntegerPeer's video stream resolution height. -
video.frameRate!~YUIDOC_LINE~!IntegerPeer's video stream resolution minimum frame rate.
-
-
mediaStatusJSONPeer stream status.
-
audioMutedBooleanIf peer's audio stream is muted. -
videoMutedBooleanIf peer's video stream is muted.
-
-
userDataJSON | StringPeer's custom user data.
-
-
isSelfBooleanIs the peer self.
peerLeft
Event fired when a peer leaves the room
Event Payload:
-
peerIdStringPeerId of the peer that left.
-
peerInfoJSONPeer's information.
-
settingsJSONPeer's stream settings.
-
audioBoolean | JSONPeer's audio stream settings. -
audio.stereoBooleanIf peer has stereo enabled or not. -
videoBoolean | JSONPeer's video stream settings. -
video.resolution!~YUIDOC_LINE~!JSONPeer's video stream resolution [Rel: Skyway.VIDEO_RESOLUTION] -
video.resolution.width!~YUIDOC_LINE~!IntegerPeer's video stream resolution width. -
video.resolution.height!~YUIDOC_LINE~!IntegerPeer's video stream resolution height. -
video.frameRate!~YUIDOC_LINE~!IntegerPeer's video stream resolution minimum frame rate.
-
-
mediaStatusJSONPeer stream status.
-
audioMutedBooleanIf peer's audio stream is muted. -
videoMutedBooleanIf peer's video stream is muted.
-
-
userDataJSON | StringPeer's custom user data.
-
-
isSelfBooleanIs the peer self.
peerUpdated
Event fired when a peer information is updated.
Event Payload:
-
peerIdStringPeerId of the peer that had information updaed.
-
peerInfoJSONPeer's information.
-
settingsJSONPeer's stream settings.
-
audioBoolean | JSONPeer's audio stream settings. -
audio.stereoBooleanIf peer has stereo enabled or not. -
videoBoolean | JSONPeer's video stream settings. -
video.resolution!~YUIDOC_LINE~!JSONPeer's video stream resolution [Rel: Skyway.VIDEO_RESOLUTION] -
video.resolution.width!~YUIDOC_LINE~!IntegerPeer's video stream resolution width. -
video.resolution.height!~YUIDOC_LINE~!IntegerPeer's video stream resolution height. -
video.frameRate!~YUIDOC_LINE~!IntegerPeer's video stream resolution minimum frame rate.
-
-
mediaStatusJSONPeer stream status.
-
audioMutedBooleanIf peer's audio stream is muted. -
videoMutedBooleanIf peer's video stream is muted.
-
-
userDataJSON | StringPeer's custom user data.
-
-
isSelfBooleanIs the peer self.
presenceChanged
deprecated
private
TODO Event fired when a peer joins the room
Event Payload:
-
usersJSONThe list of users
readyStateChange
Event fired whether the room is ready for use.
Event Payload:
-
readyStateString[Rel: Skyway.READY_STATE_CHANGE]
-
errorJSONError object thrown.
-
statusIntegerHttp status when retrieving information. May be empty for other errors.
-
contentStringError message.
-
errorCodeIntegerError code. [Rel: Skyway.READY_STATE_CHANGE_ERROR]
-
roomLock
Event fired when a room lock status has changed.
Event Payload:
-
isLockedBooleanIs the room locked.
-
peerIdStringPeerId of the peer that is locking/unlocking the room.
-
peerInfoJSONPeer's information.
-
settingsJSONPeer's stream settings.
-
audioBoolean | JSONPeer's audio stream settings. -
audio.stereoBooleanIf peer has stereo enabled or not. -
videoBoolean | JSONPeer's video stream settings. -
video.resolution!~YUIDOC_LINE~!JSONPeer's video stream resolution [Rel: Skyway.VIDEO_RESOLUTION] -
video.resolution.width!~YUIDOC_LINE~!IntegerPeer's video stream resolution width. -
video.resolution.height!~YUIDOC_LINE~!IntegerPeer's video stream resolution height. -
video.frameRate!~YUIDOC_LINE~!IntegerPeer's video stream resolution minimum frame rate.
-
-
mediaStatusJSONPeer stream status.
-
audioMutedBooleanIf peer's audio stream is muted. -
videoMutedBooleanIf peer's video stream is muted.
-
-
userDataJSON | StringPeer's custom user data.
-
-
isSelfBooleanIs the peer self.
systemAction
Event fired when the signaling server warns the user.
Event Payload:
-
actionStringThe action that is required for the user to follow. [Rel: Skyway.SYSTEM_ACTION]
-
messageStringThe reason for the action.