Skylink Class
Defined in: source/template/header.js:8
Available since 0.5.0
Documentation Notes
Please refer to the init()
method for a guide to initializing Skylink.
Please Note:
- You must subscribe Skylink events before calling init().
- You will need an API key to use Skylink, if you do not have one you can register for a developer account in the Skylink Developer Console.
Skylink
()
Example:
// Getting started on how to use Skylink var SkylinkDemo = new Skylink(); SkylinkDemo.init('apiKey');
SkylinkDemo.joinRoom('my_room', { userData: 'My Username', audio: true, video: true });
SkylinkDemo.on('incomingStream', function (peerId, stream, peerInfo, 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); } });
SkylinkDemo.on('peerLeft', function (peerId, peerInfo, isSelf) { if (isSelf) { document.getElementById('selfVideo').src = ''; } else { var peerVideo = document.getElementById(peerId); document.getElementById('peersVideo').removeChild(peerVideo); } });
_ACKProtocolHandler
senderPeerId
,
data
,
channelName
,
)
Handles the ACK request.
Triggers:
dataTransferStateParameters:
-
senderPeerId
{String}The peerId of the sender.
-
data
{JSON}The ACK data object. [Rel: Skylink._DC_PROTOCOL_TYPE.ACK.data]
-
channelName
{String}The DataChannel name related to the DataTransfer.
_addIceCandidateFromQueue
targetMid
,
)
Adds all stored ICE Candidates received before handshaking.
Parameters:
-
targetMid
{String}The peerId of the target peer.
_addIceCandidateToQueue
targetMid
,
candidate
,
)
Stores an ICE Candidate received before handshaking
Parameters:
-
targetMid
{String}The peerId of the target peer.
-
candidate
{Object}The ICE Candidate object.
_addLocalMediaStreams
peerId
,
)
Sends our Local MediaStreams to other Peers. By default, it sends all it's other stream
Parameters:
-
peerId
{String}The peerId of the peer to send local stream to.
_addPeer
targetMid
,
peerBrowser
,
[toOffer=false]
,
[restartConn=false]
,
[receiveOnly=false]
,
)
Initiates a Peer connection with either a response to an answer or starts a connection with an offer.
Parameters:
-
targetMid
{String}PeerId of the peer we should connect to.
-
peerBrowser
{JSON}The peer browser information.
-
agent
{String}The peer browser agent.
-
version
{Integer}The peer browser version.
-
-
toOffer
{Boolean} OptionalDEFAULT: falseWhether we should start the O/A or wait.
-
restartConn
{Boolean} OptionalDEFAULT: falseWhether connection is restarted.
-
receiveOnly
{Boolean} OptionalDEFAULT: falseShould they only receive?
_addSDPStereo
sdpLines
,
)
Enables the stereo feature by modifying the SDP. This requires the OPUS to be enabled in the connection first.
Parameters:
-
sdpLines
{Array}Sdp received.
Returns:
Updated version with Stereo feature
_answerHandler
message
,
)
Handles the ANSWER Message event.
Triggers:
handshakeProgressParameters:
-
message
{JSON}The Message object received. [Rel: Skylink._SIG_MESSAGE_TYPE.ANSWER.message]
_base64ToBlob
dataURL
,
)
Converts a Base64 encoded string to a Blob.
- Not Implemented: Handling of URLEncoded DataURIs.
Parameters:
-
dataURL
{String}Blob base64 dataurl.
_byeHandler
message
,
)
Handles the BYTE Message event.
Triggers:
peerLeftParameters:
-
message
{JSON}The Message object received. [Rel: Skylink._SIG_MESSAGE_TYPE.BYE.message]
_CANCELProtocolHandler
senderPeerId
,
data
,
channelName
,
)
Handles the CANCEL request.
Triggers:
dataTransferStateParameters:
-
senderPeerId
{String}The peerId of the sender.
-
data
{JSON}The CANCEL data object. [Rel: Skylink._DC_PROTOCOL_TYPE.CANCEL.data]
-
channelName
{String}The DataChannel name related to the DataTransfer.
_candidateHandler
message
,
)
Handles the CANDIDATE Message event.
Parameters:
-
message
{JSON}The Message object received. [Rel: Skylink._SIG_MESSAGE_TYPE.CANDIDATE.message]
_checkDataChannelReadyState
dataChannel
,
callback
,
readyState
,
)
Checks and triggers provided callback when the current DataChannel readyState is the same as the readyState provided.
Parameters:
-
dataChannel
{Object}The DataChannel readyState to check on.
-
callback
{Function}The callback to be fired when DataChannel readyState matches the readyState provided.
-
readyState
{String}The DataChannel readystate to match. [Rel: DATA_CHANNEL_STATE]
_chunkBlobData
blob
,
blobByteSize
,
)
Chunks a Blob into Blob chunks based on a fixed size.
Parameters:
-
blob
{Blob}The Blob data to chunk.
-
blobByteSize
{Integer}The original Blob data size.
_clearAllStoredLogsFn
[logLevel]
,
)
Gets the list of logs
Parameters:
-
logLevel
{Integer} OptionalThe log level that get() should return. If not provided, it get() will return all logs from all levels. [Rel: Skylink.LOG_LEVEL]
Returns:
The array of logs
_clearDataChannelTimeout
peerId
,
[isSender=false]
,
)
Clears the timeout set for the DataTransfer.
Parameters:
-
peerId
{String}The responding peerId of the peer to await for response during the DataTransfer.
-
isSender
{Boolean} OptionalDEFAULT: falseThe flag to indicate if the response received is from the sender or the receiver.
_closeChannel
()
Closes the socket signaling connection.
_closeDataChannel
peerId
,
)
Closes the peer's DataChannel based on the peerId provided.
Parameters:
-
peerId
{String}The peerId associated with the DataChannel to be closed.
_condition
eventName
,
callback
,
checkFirst
,
[condition]
,
[fireAlways=false]
,
)
Does a check condition first to check if event is required to be subscribed. If check condition fails, it subscribes an event with once() method to wait for the condition to pass to fire the callback.
Parameters:
-
eventName
{String}The Skylink event.
-
callback
{Function}The callback fired after the condition is met.
-
checkFirst
{Function}The condition to check that if pass, it would fire the callback, or it will just subscribe to an event and fire when condition is met.
-
condition
{Function} OptionalThe provided condition that would trigger this event. If not provided, it will return true when the event is triggered. Return a true to fire the callback.
-
fireAlways
{Boolean} OptionalDEFAULT: falseThe function does not get removed onced triggered, but triggers everytime the event is called.
_createDataChannel
peerId
,
[dataChannel]
,
)
Creates and binds events to a SCTP DataChannel.
Triggers:
dataChannelStateParameters:
-
peerId
{String}The peerId to tie the DataChannel to.
-
dataChannel
{Object} OptionalThe datachannel object received.
Returns:
New DataChannel with events.
_createDefaultSocket
()
Create the default socket object connection.
_createFallbackSocket
()
Create the fallback socket object reconnection.
_createLongpollingSocket
()
Create the long-polling fallback socket object reconnection.
_createPeerConnection
targetMid
,
)
Creates a Peer connection to communicate with the peer whose ID is 'targetMid'. All the peerconnection callbacks are set up here. This is a quite central piece.
Parameters:
-
targetMid
{String}
Returns:
The created peer connection object.
_createSocket
()
Create the socket object to refresh connection.
_dataChannelProtocolHandler
data
,
senderPeerId
,
channelName
,
)
Handles the DataTransfer protocol stage and invokes the related handler function.
Parameters:
-
data
{String | Object}The DataTransfer data received from the DataChannel.
-
senderPeerId
{String}The peerId of the sender.
-
channelName
{String}The DataChannel name related to the DataTransfer.
_DATAProtocolHandler
senderPeerId
,
dataString
,
dataType
,
channelName
,
)
Handles the DATA request.
Triggers:
dataTransferStateParameters:
-
senderPeerId
{String}The peerId of the sender.
-
dataString
{ArrayBuffer | Blob | String}The data received. [Rel: Skylink._DC_PROTOCOL_TYPE.DATA.data]
-
dataType
{String}The data type received from datachannel. [Rel: Skylink.DATA_TRANSFER_DATA_TYPE]
-
channelName
{String}The DataChannel name related to the DataTransfer.
_doAnswer
targetMid
,
)
Creates an answer to Peer as a response to Peer's offer.
Parameters:
-
targetMid
{String}PeerId of the peer to send answer to.
_doOffer
targetMid
,
peerBrowser
,
)
Creates an offer to Peer to initate Peer connection.
Parameters:
-
targetMid
{String}PeerId of the peer to send offer to.
-
peerBrowser
{JSON}The peer browser information.
-
agent
{String}The peer browser agent.
-
version
{Integer}The peer browser version.
-
_enterHandler
message
,
)
Handles the ENTER Message event.
Triggers:
handshakeProgress, peerJoinedParameters:
-
message
{JSON}The Message object received. [Rel: Skylink._SIG_MESSAGE_TYPE.ENTER.message]
_ERRORProtocolHandler
senderPeerId
,
data
,
channelName
,
)
Handles the ERROR request.
Triggers:
dataTransferStateParameters:
-
senderPeerId
{String}The peerId of the sender.
-
data
{JSON}The ERROR data object. [Rel: Skylink._DC_PROTOCOL_TYPE.ERROR.data]
-
channelName
{String}The DataChannel name related to the DataTransfer.
_findSDPLine
sdpLines
,
condition
,
)
Finds a line in the SDP that contains the condition string and returns it.
Parameters:
-
sdpLines
{Array}Sdp received.
-
condition
{Array}Return if one of the conditions satisfies.
Returns:
[index, line] - Returns the sdpLines based on the condition
_getStoredLogsFn
[logLevel]
,
)
Gets the list of logs
Parameters:
-
logLevel
{Integer} OptionalThe log level that get() should return. If not provided, it get() will return all logs from all levels. [Rel: Skylink.LOG_LEVEL]
Returns:
The array of logs
_initSelectedRoom
[room=Skylink._defaultRoom]
,
callback
,
)
Initialize Skylink to retrieve new connection information based on options.
Triggers:
readyStateChangeParameters:
-
room
{String} OptionalDEFAULT: Skylink._defaultRoomThe room to connect to.
-
callback
{Function}The callback fired once Skylink is re-initialized.
_inRoomHandler
message
,
)
Handles the IN_ROOM Message event.
Triggers:
peerJoinedParameters:
-
message
{JSON}The Message object received. [Rel: Skylink._SIG_MESSAGE_TYPE.IN_ROOM.message]
_loadInfo
()
Start the loading of information from the api server.
Triggers:
readyStateChange_logFn
logLevel
,
message
,
[debugObject]
,
)
Logs all the console information.
Parameters:
-
logLevel
{String}The log level.
-
message
{Array | String}The console message.
-
0
{String}The targetPeerId the message is targeted to.
-
1
{String}The interface the message is targeted to.
-
2
{String | Array}The events the message is targeted to.
-
3:
{String}The log message.
-
-
debugObject
{Object | String} OptionalThe console parameter string or object.
_MESSAGEProtocolHandler
senderPeerId
,
data
,
channelName
,
)
Handles the MESSAGE request.
Triggers:
incomingMessageParameters:
-
senderPeerId
{String}The peerId of the sender.
-
data
{JSON}The ACK data object. [Rel: Skylink._DC_PROTOCOL_TYPE.MESSAGE.data]
-
channelName
{String}The DataChannel name related to the DataTransfer.
_muteAudioEventHandler
message
,
)
Handles the MUTE_AUDIO Message event.
Triggers:
peerUpdatedParameters:
-
message
{JSON}The Message object received. [Rel: Skylink._SIG_MESSAGE_TYPE.MUTE_AUDIO.message]
_muteLocalMediaStreams
()
Handles the muting of audio and video streams.
Returns:
options.hasVideoTracks If MediaStream(s) has video tracks.
_muteVideoEventHandler
message
,
)
Handles the MUTE_VIDEO Message event.
Triggers:
peerUpdatedParameters:
-
message
{JSON}The Message object received. [Rel: Skylink._SIG_MESSAGE_TYPE.MUTE_VIDEO.message]
_offerHandler
message
,
)
Handles the OFFER Message event.
Triggers:
handshakeProgressParameters:
-
message
{JSON}The Message object received. [Rel: Skylink._SIG_MESSAGE_TYPE.OFFER.messa]
_onIceCandidate
targetMid
,
event
,
)
An ICE candidate has just been generated (ICE gathering) and will be sent to the peer. Part of connection establishment.
Triggers:
candidateGenerationStateParameters:
-
targetMid
{String}The peerId of the target peer.
-
event
{Event}This is provided directly by the peerconnection API.
_onRemoteStreamAdded
targetMid
,
event
,
)
The remote peer advertised streams, that we are forwarding to the app. This is part of the peerConnection's addRemoteDescription() API's callback.
Triggers:
incomingStreamParameters:
-
targetMid
{String}PeerId of the peer that has remote stream to send.
-
event
{Event}This is provided directly by the peerconnection API.
_onUserMediaError
error
,
)
Access to user's MediaStream failed.
Triggers:
mediaAccessErrorParameters:
-
error
{Object}Error object that was thrown.
_onUserMediaSuccess
stream
,
)
Access to user's MediaStream is successful.
Triggers:
mediaAccessSuccessParameters:
-
stream
{MediaStream}MediaStream object.
_openChannel
()
Initiate a socket signaling connection.
Triggers:
channelMessage, channelOpen, channelError, channelClose_parseAudioStreamSettings
[options=false]
,
)
Parse stream settings
Parameters:
-
options
{Boolean | JSON} OptionalDEFAULT: falseThis call requires video
-
resolution
{JSON} Optional[Rel: Skylink.VIDEO_RESOLUTION]
-
width
{Integer} OptionalVideo width -
height
{Integer} OptionalVideo height
-
-
frameRate
{Integer} OptionalMaximum frameRate of Video
-
Returns:
The parsed video options.
- settings: User set video options
- userMedia: getUserMedia options
_parseAudioStreamSettings
[options=false]
,
)
Parse stream settings
Parameters:
-
options
{Boolean | JSON} OptionalDEFAULT: falseThis call requires audio
-
stereo
{Boolean} OptionalEnabled stereo or not.
-
Returns:
The parsed audio options.
- settings: User set audio options
- userMedia: getUserMedia options
_parseBandwidthSettings
[options]
,
)
Parse and set bandwidth settings.
Parameters:
-
options
{String} OptionalBandwidth settings
-
audio
{String} OptionalDEFAULT: 50Audio Bandwidth
-
video
{String} OptionalDEFAULT: 256Video Bandwidth
-
data
{String} OptionalDEFAULT: 1638400Data Bandwidth
-
_parseDefaultMediaStreamSettings
options
,
)
Parse stream default settings
Parameters:
-
options
{JSON}Media default Constraints.
-
maxWidth
{Boolean | JSON} OptionalDEFAULT: 640Video default width.
-
maxHeight
{Boolean} OptionalDEFAULT: 480Video default height.
-
_parseInfo
info
,
)
Parse the information received from the api server.
Triggers:
readyStateChangeParameters:
-
info
{JSON}The parsed information from the server.
_parseMediaStreamSettings
options
,
)
Parse stream settings
Parameters:
-
options
{JSON}Media Constraints.
-
audio
{Boolean | JSON} OptionalDEFAULT: falseThis call requires audio
-
stereo
{Boolean} OptionalEnabled stereo or not. -
mute
{Boolean} OptionalDEFAULT: false If audio stream should be muted.
-
-
video
{Boolean | JSON} OptionalDEFAULT: falseThis call requires video
-
resolution
{JSON} Optional[Rel: VIDEO_RESOLUTION] -
resolution.width
{Integer} OptionalVideo width -
resolution.height
{Integer} OptionalVideo height -
frameRate
{Integer} OptionalMaximum frameRate of video. -
mute
{Boolean} OptionalDEFAULT: false If video stream should be muted.
-
-
_parseMutedSettings
options
,
)
Parse stream settings
Parameters:
-
options
{JSON}Media Constraints.
-
audio
{Boolean | JSON} OptionalDEFAULT: falseThis call requires audio
-
stereo
{Boolean} OptionalEnabled stereo or not. -
mute
{Boolean} OptionalDEFAULT: false If audio stream should be muted.
-
-
video
{Boolean | JSON} OptionalDEFAULT: falseThis call requires video
-
resolution
{JSON} Optional[Rel: VIDEO_RESOLUTION] -
resolution.width
{Integer} OptionalVideo width -
resolution.height
{Integer} OptionalVideo height -
frameRate
{Integer} OptionalMaximum frameRate of video. -
mute
{Boolean} OptionalDEFAULT: false If video stream should be muted.
-
-
Returns:
The parsed muted options.
_parseUserData
[userData]
,
)
Gets the Peer information (media settings,media status and personnal data set by the peer).
Parameters:
-
userData
{JSON} OptionalUser custom data.
_printAllStoredLogsFn
()
Print out all the store logs in console.
_privateMessageHandler
message
,
)
Handles the PRIVATE_MESSAGE Message event.
Triggers:
privateMessageParameters:
-
message
{JSON}The Message object received. [Rel: Skylink._SIG_MESSAGE_TYPE.PRIVATE_MESSAGE.message]
_processingSingleMessage
message
,
)
Handles the single signaling message received.
Parameters:
-
message
{JSON}The message object received.
_processSigMessage
messageString
,
)
Handles every incoming signaling message received.
Parameters:
-
messageString
{String}The message object stringified received.
_publicMessageHandler
message
,
)
Handles the PUBLIC_MESSAGE Message event.
Triggers:
publicMessageParameters:
-
message
{JSON}The Message object received. [Rel: Skylink._SIG_MESSAGE_TYPE.PUBLIC_MESSAGE.message]
_redirectHandler
message
,
)
Handles the REDIRECT Message event.
Triggers:
systemActionParameters:
-
message
{JSON}The Message object received. [Rel: Skylink._SIG_MESSAGE_TYPE.REDIRECT.message]
_removePeer
peerId
,
)
Removes and closes a Peer connection.
Triggers:
peerLeftParameters:
-
peerId
{String}PeerId of the peer to close connection.
_removeSDPFirefoxH264Pref
sdpLines
,
)
Removes Firefox 32 H262 preference in the SDP to prevent breaking connection in unsupported browsers.
Parameters:
-
sdpLines
{Array}The session description received.
Returns:
Updated session description.
_requestServerInfo
method
,
url
,
callback
,
params
,
)
Gets information from api server.
Parameters:
-
method
{String}The http method.
-
url
{String}The url to do a rest call.
-
callback
{Function}The callback fired after Skylink receives a response from the api server.
-
params
{JSON}HTTP Params
_restartHandler
message
,
)
Handles the RESTART Message event.
Triggers:
handshakeProgress, peerRestartParameters:
-
message
{JSON}The Message object received. [Rel: Skylink._SIG_MESSAGE_TYPE.RESTART.message]
_restartPeerConnection
peerId
,
isSelfInitiatedRestart
,
[callback]
,
)
Restarts a Peer connection.
Parameters:
-
peerId
{String}PeerId of the peer to restart connection with.
-
isSelfInitiatedRestart
{Boolean}Indicates whether the restarting action was caused by self.
-
callback
{Function} OptionalThe callback once restart peer connection is completed.
_roomLockEventHandler
message
,
)
Handles the ROOM_LOCK Message event.
Triggers:
roomLockParameters:
-
message
{JSON}The Message object received. [Rel: Skylink._SIG_MESSAGE_TYPE.ROOM_LOCK.message]
_sendBlobDataToPeer
data
,
dataInfo
,
[targetPeerId]
,
isPrivate
,
)
Initiates a DataTransfer with the peer.
Parameters:
-
data
{Blob}The Blob data to send.
-
target
{Boolean}The real peerId to send data to, in the case where MCU is enabled.
-
-
dataInfo
{JSON}The Blob data information.
-
transferId
{String}The transferId of the DataTransfer.
-
name
{String}The Blob data name.
-
timeout
{Integer} OptionalDEFAULT: 60The timeout set to await for response from peer.
-
size
{Integer}The Blob data size.
-
-
targetPeerId
{String} OptionalThe peerId of the peer to start the DataTransfer. To start the DataTransfer to all peers, set as
false
. -
isPrivate
{Boolean}The flag to indicate if the DataTransfer is broadcasted to other peers or sent to the peer privately.
_sendChannelMessage
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:
-
message
{JSON}
_sendDataChannelMessage
peerId
,
data
,
)
Sends a Message via the peer's DataChannel based on the peerId provided.
Triggers:
dataChannelStateParameters:
-
peerId
{String}The peerId associated with the DataChannel to send from.
-
data
{JSON}The Message data to send.
_setDataChannelTimeout
peerId
,
timeout
,
[isSender=false]
,
)
Sets a waiting timeout for the request received from the peer. Once timeout has expired, an error would be thrown.
Parameters:
-
peerId
{String}The responding peerId of the peer to await for response during the DataTransfer.
-
timeout
{Integer}The timeout to set in seconds.
-
isSender
{Boolean} OptionalDEFAULT: falseThe flag to indicate if the response received is from the sender or the receiver.
_setFirefoxIceServers
config
,
)
Sets the STUN server specifically for Firefox ICE Connection.
Parameters:
-
config
{JSON}Ice configuration servers url object.
Returns:
Updated configuration
_setIceServers
config
,
)
Sets the STUN server specially for Firefox for ICE Connection.
Parameters:
-
config
{JSON}Ice configuration servers url object.
Returns:
Updated configuration
_setLocalAndSendMessage
targetMid
,
sessionDescription
,
)
Sets a generated session description and sends to Peer.
Triggers:
handshakeProgressParameters:
-
targetMid
{String}PeerId of the peer to send offer/answer to.
-
sessionDescription
{JSON}This should be provided by the peerconnection API. User might 'tamper' with it, but then , the setLocal may fail.
_setSDPBitrate
sdpLines
,
)
Set the audio, video and data streamming bandwidth by modifying the SDP. It sets the bandwidth when the connection is good. In low bandwidth environment, the bandwidth is managed by the browser.
Parameters:
-
sdpLines
{Array}The session description received.
Returns:
Updated session description.
_setSDPVideoResolution
sdpLines
,
)
Sets the video resolution by modifying the SDP.
- This is broken.
Parameters:
-
sdpLines
{Array}Sdp received.
Returns:
Updated version with custom Resolution settings
_startPeerConnectionHealthCheck
peerId
,
)
Starts a Peer connection health check. The health timers waits for connection, and within 1m if there is not connection, it attempts a reconnection.
Parameters:
-
peerId
{String}The peerId of the peer to set a connection timeout if connection failed.
_stopPeerConnectionHealthCheck
peerId
,
)
Stops a Peer connection health check.
Parameters:
-
peerId
{String}The peerId of the peer to clear the checking.
_streamEventHandler
message
,
)
Handles the STREAM Message event.
Triggers:
peerUpdatedParameters:
-
message
{JSON}The Message object received. [Rel: Skylink._SIG_MESSAGE_TYPE.STREAM.message]
_throttle
func
,
wait
,
)
Returns a wrapper of the original function, which only fires once during a specified amount of time.
Parameters:
-
func
{Function}The function that should be throttled.
-
wait
{Integer}The amount of time that function need to throttled (in ms)
_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:
-
eventName
{String}The Skylink event.
_updateUserEventHandler
message
,
)
Handles the UPDATE_USER Message event.
Triggers:
peerUpdatedParameters:
-
message
{JSON}The Message object received. [Rel: Skylink._SIG_MESSAGE_TYPE.UPDATE_USER.message]
_wait
callback
,
condition
,
[intervalTime=50]
,
)
Sets an interval check. If condition is met, fires callback.
Parameters:
-
callback
{Function}The callback fired after the condition is met.
-
condition
{Function}The provided condition that would trigger this the callback.
-
intervalTime
{Integer} OptionalDEFAULT: 50The interval loop timeout.
_waitForLocalMediaStream
callback
,
[options]
,
)
Waits for MediaStream.
- Once the stream is loaded, callback is called
- If there's not a need for stream, callback is called
Triggers:
mediaAccessRequiredParameters:
-
callback
{Function}Callback after requested constraints are loaded.
-
options
{JSON} OptionalMedia Constraints.
-
userData
{JSON} OptionalUser custom data.
-
audio
{Boolean | JSON} OptionalDEFAULT: falseThis call requires audio
-
stereo
{Boolean} OptionalEnabled stereo or not -
mute
{Boolean} OptionalDEFAULT: false If audio stream should be muted.
-
-
video
{Boolean | JSON} OptionalDEFAULT: falseThis call requires video
-
resolution
{JSON} Optional[Rel: VIDEO_RESOLUTION] -
resolution.width
{Integer} OptionalVideo width -
resolution.height
{Integer} OptionalVideo height -
frameRate
{Integer} OptionalMaximum frameRate of Video -
mute
{Boolean} OptionalDEFAULT: false If video stream should be muted.
-
-
bandwidth
{String} OptionalBandwidth settings
-
audio
{String} OptionalAudio Bandwidth -
video
{String} OptionalVideo Bandwidth -
data
{String} OptionalData Bandwidth
-
-
_waitForOpenChannel
[options]
,
)
Waits for room to ready, before starting the Room connection.
Triggers:
peerJoined, incomingStream, mediaAccessRequiredParameters:
-
options
{JSON} OptionalMedia Constraints.
-
userData
{JSON | String} OptionalUser custom data.
-
audio
{Boolean | JSON} OptionalDEFAULT: falseThis call requires audio stream.
-
stereo
{Boolean} OptionalOption to enable stereo during call. -
mute
{Boolean} OptionalDEFAULT: false If audio stream should be muted.
-
-
video
{Boolean | JSON} OptionalDEFAULT: falseThis call requires video stream.
-
resolution
{JSON} OptionalThe resolution of video stream. -
resolution.width
{Integer} OptionalThe video stream resolution width. -
resolution.height
{Integer} OptionalThe video stream resolution height. -
frameRate
{Integer} OptionalThe video stream maximum frameRate. -
mute
{Boolean} OptionalDEFAULT: false If video stream should be muted.
-
-
bandwidth
{JSON} OptionalStream bandwidth settings.
-
audio
{Integer} OptionalAudio stream bandwidth in kbps. Recommended: 50 kbps. -
video
{Integer} OptionalVideo stream bandwidth in kbps. Recommended: 256 kbps. -
data
{Integer} OptionalData stream bandwidth in kbps. Recommended: 1638400 kbps.
-
-
_welcomeHandler
message
,
)
Handles the WELCOME Message event.
Triggers:
handshakeProgress, peerJoinedParameters:
-
message
{JSON}The Message object received. [Rel: Skylink._SIG_MESSAGE_TYPE.WELCOME.message]
_WRQProtocolHandler
senderPeerId
,
data
,
channelName
,
)
Handles the WRQ request.
Triggers:
dataTransferStateParameters:
-
senderPeerId
{String}The peerId of the sender.
-
data
{JSON}The WRQ data object. [Rel: Skylink._DC_PROTOCOL_TYPE.WRQ.data]
-
channelName
{String}The DataChannel name related to the DataTransfer.
cancelBlobTransfer
[peerId]
,
[transferType]
,
)
Cancels or terminates an ongoing DataTransfer request.
Triggers:
dataTransferState.Parameters:
-
peerId
{String} OptionalThe peerId of the peer associated with the DataTransfer to cancel.
-
transferType
{String} OptionalThe transfer type of the request. Is it an ongoing uploading stream to reject or an downloading stream. If not transfer type is provided, it cancels all DataTransfer associated with the peer. [Rel: Skylink.DATA_TRANSFER_TYPE]
disableAudio
()
Disable microphone.
- Try to disable the microphone.
- If no microphone was initially set, this function has no effect.
Triggers:
peerUpdated, peerRestartExample:
SkylinkDemo.disableAudio();
disableVideo
()
Disable video source.
- Try to disable the video source.
- If no video source was initially set, this function has no effect.
Triggers:
peerUpdated, peerRestartExample:
SkylinkDemo.disableVideo();
enableAudio
()
Enable microphone.
- Try to start the audio source.
- If no audio source was initialy set, this function has no effect.
- If you want to activate your audio but haven't initially enabled it you would need to reinitiate your connection with joinRoom() process and set the audio parameter to true.
Triggers:
peerUpdated, peerRestartExample:
SkylinkDemo.enableAudio();
enableVideo
()
Enable webcam video.
- Try to start the video source.
- If no video source was initialy set, this function has no effect.
- If you want to activate your video but haven't initially enabled it you would need to reinitiate your connection with joinRoom() process and set the video parameter to true.
Triggers:
peerUpdated, peerRestartExample:
SkylinkDemo.enableVideo();
getPeerInfo
[peerId]
,
)
Gets the Peer information.
- If there is no information related to the peer,
null
would be returned.
Parameters:
-
peerId
{String} OptionalThe peerId of the peer retrieve we want to retrieve the information. Leave this blank to return the User information.
Returns:
Peer information. Please reference
peerJoined
peerInfo
parameter.
Example:
// Example 1: To get other peer's information var peerInfo = SkylinkDemo.getPeerInfo(peerId);
// Example 2: To get own information var userInfo = SkylinkDemo.getPeerInfo();
getUserData
()
Gets the User custom data. See setUserData() for more information
Returns:
User custom data.
Example:
var userInfo = SkylinkDemo.getUserData();
getUserMedia
[options]
,
[callback]
,
)
Gets the default video source and microphone source.
- This is an implemented function for Skylink.
- Constraints are not the same as the MediaStreamConstraints specified in the w3c specs.
- Calling getUserMedia while having streams being sent to another peer may actually cause problems, because currently getUserMedia refreshes all streams.
Triggers:
mediaAccessSuccess, mediaAccessError, streamEndedParameters:
-
options
{JSON} OptionalMediaStream constraints.
-
audio
{JSON | Boolean} OptionalDEFAULT: trueOption to allow audio stream.
-
stereo
{Boolean} OptionalOption to enable stereo during call. -
mute
{Boolean} OptionalDEFAULT: false If audio stream should be muted.
-
-
video
{JSON | Boolean} OptionalDEFAULT: trueOption to allow video stream.
-
resolution
{JSON} OptionalThe resolution of video stream. [Rel: Skylink.VIDEO_RESOLUTION] -
resolution.width
{Integer} OptionalThe video stream resolution width (in px). -
resolution.height
{Integer} OptionalThe video stream resolution height (in px). -
frameRate
{Integer} OptionalThe video stream maximum frameRate. -
mute
{Boolean} OptionalDEFAULT: false If video stream should be muted.
-
-
-
callback
{Function} OptionalThe callback fired after media was successfully accessed. Default signature: function(error object, success object)
Example:
// Default is to get both audio and video // Example 1: Get both audio and video by default. SkylinkDemo.getUserMedia();
// Example 2: Get the audio stream only SkylinkDemo.getUserMedia({ 'video' : false, 'audio' : true });
// Example 3: Set the stream settings for the audio and video SkylinkDemo.getUserMedia({ 'video' : { 'resolution': SkylinkDemo.VIDEO_RESOLUTION.HD, 'frameRate': 50 }, 'audio' : { 'stereo': true } });
// Example 4: Get user media with callback SkylinkDemo.getUserMedia({ 'video' : false, 'audio' : true },function(error,success){ if (error){ console.log(error); } else{ console.log(success); } });
init
options
,
[callback]
,
)
Initialize Skylink to retrieve connection information. This is the first method to invoke before using any of Skylink functionalities.
- Credentials parsing is not usabel.
Triggers:
readyStateChangeParameters:
-
options
{String | JSON}Connection options or API Key ID
-
apiKey
{String}API Key ID to identify with the Temasys backend server
-
defaultRoom
{String} OptionalThe default room to connect to if there is no room provided in joinRoom().
-
roomServer
{String} OptionalPath to the Temasys backend server. If there's no room provided, default room would be used.
-
region
{String} OptionalThe regional server that user chooses to use. [Rel: Skylink.REGIONAL_SERVER]
-
enableIceTrickle
{Boolean} OptionalDEFAULT: trueThe option to enable ICE trickle or not.
-
enableDataChannel
{Boolean} OptionalDEFAULT: trueThe option to enable enableDataChannel or not.
-
enableTURNServer
{Boolean} OptionalDEFAULT: trueTo enable TURN servers in ice connection. Please do so at your own risk as it might disrupt the connection.
-
enableSTUNServer
{Boolean} OptionalDEFAULT: trueTo enable STUN servers in ice connection. Please do so at your own risk as it might disrupt the connection.
-
TURNServerTransport
{Boolean} OptionalDEFAULT: Skylink.TURN_TRANSPORT.ANYTransport to set the transport packet type. [Rel: Skylink.TURN_TRANSPORT]
-
credentials
{JSON} OptionalCredentials options for setting a static meeting.
-
startDateTime
{String}The start timing of the meeting in Date ISO String -
duration
{Integer}The duration of the meeting -
credentials
{String}The credentials required to set the timing and duration of a meeting.
-
-
audioFallback
{Boolean} OptionalDEFAULT: falseTo allow the option to fallback to audio if failed retrieving video stream.
-
forceSSL
{Boolean} OptionalDEFAULT: falseTo force SSL connections to the API server and signaling server.
-
socketTimeout
{Integer} OptionalDEFAULT: 20000To set the timeout for socket to fail and attempt a reconnection. The mininum value is 5000.
-
-
callback
{Function} OptionalThe callback fired after the room was initialized. Default signature: function(error object, success object)
Example:
// Note: Default room is apiKey when no room // Example 1: To initalize without setting any default room. SkylinkDemo.init('apiKey');
// Example 2: To initialize with apikey, roomServer and defaultRoom SkylinkDemo.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)); SkylinkDemo.init({ 'apiKey' : 'apiKey', 'roomServer' : 'http://xxxx.com', 'defaultRoom' : 'mainHangout' 'credentials' : { 'startDateTime' : (new Date()).toISOString(), 'duration' : 500, 'credentials' : credentials } });
// Example 4: To initialize with callback SkylinkDemo.init('apiKey',function(error,success){ if (error){ console.log('Init failed: '+JSON.stringify(error)); } else{ console.log('Init succeed: '+JSON.stringify(success)); } });
joinRoom
[room=init.options.defaultRoom]
,
[options]
,
[callback]
,
)
Connects the User to a Room.
Triggers:
peerJoined, mediaAccessRequiredParameters:
-
room
{String} OptionalDEFAULT: init.options.defaultRoomRoom name to join. If Room name is not provided, User would join the default room.
-
options
{JSON} OptionalMedia Constraints
-
userData
{JSON | String} OptionalUser custom data. See setUserData() for more information
-
audio
{Boolean | JSON} OptionalDEFAULT: falseEnable audio stream.
-
stereo
{Boolean} OptionalOption to enable stereo during call. -
mute
{Boolean} OptionalDEFAULT: false If audio stream should be muted.
-
-
video
{Boolean | JSON} OptionalDEFAULT: falseEnable video stream.
-
resolution
{JSON} OptionalThe resolution of video stream. [Rel: Skylink.VIDEO_RESOLUTION] -
resolution.width
{Integer} OptionalThe video stream resolution width (in px). -
resolution.height
{Integer} OptionalThe video stream resolution height (in px). -
frameRate
{Integer} OptionalThe video stream frameRate. -
mute
{Boolean} OptionalDEFAULT: false If audio stream should be muted.
-
-
bandwidth
{JSON} OptionalStream bandwidth settings.
-
audio
{Integer} OptionalDEFAULT: 50 Audio stream bandwidth in kbps. -
video
{Integer} OptionalDEFAULT: 256 Video stream bandwidth in kbps. -
data
{Integer} OptionalDEFAULT: 1638400 Data stream bandwidth in kbps.
-
-
manualGetUserMedia
{Boolean} OptionalGet the user media manually.
-
-
callback
{Function} OptionalThe callback fired after peer leaves the room. Default signature: function(error object, success object)
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 SkylinkDemo.joinRoom();
// To just join the default room with bandwidth settings SkylinkDemo.joinRoom({ 'bandwidth': { 'data': 14440 } });
// Example 1: To call getUserMedia and joinRoom seperately SkylinkDemo.getUserMedia(); SkylinkDemo.on('mediaAccessSuccess', function (stream)) { attachMediaStream($('.localVideo')[0], stream); SkylinkDemo.joinRoom(); });
// Example 2: Join a room without any video or audio SkylinkDemo.joinRoom('room');
// Example 3: Join a room with audio only SkylinkDemo.joinRoom('room', { 'audio' : true, 'video' : false });
// Example 4: Join a room with prefixed video width and height settings SkylinkDemo.joinRoom('room', { 'audio' : true, 'video' : { 'resolution' : { 'width' : 640, 'height' : 320 } } });
// Example 5: Join a room with userData and settings with audio, video // and bandwidth SkylinkDemo.joinRoom({ 'userData': { 'item1': 'My custom data', 'item2': 'Put whatever, string or JSON or array' }, 'audio' : { 'stereo' : true }, 'video' : { 'res' : SkylinkDemo.VIDEO_RESOLUTION.VGA, 'frameRate' : 50 }, 'bandwidth' : { 'audio' : 48, 'video' : 256, 'data' : 14480 } });
//Example 6: joinRoom with callback SkylinkDemo.joinRoom(function(error, success){ if (error){ console.log('Error happened. Can not join room')); } else{ console.log('Successfully joined room'); } });
leaveRoom
[callback]
,
)
Disconnects a User from the room.
Triggers:
peerLeft, channelClose, streamEndedParameters:
-
callback
{Function} OptionalThe callback fired after peer leaves the room. Default signature: function(error object, success object)
Example:
//Example 1: Just leaveRoom SkylinkDemo.leaveRoom();
//Example 2: leaveRoom with callback SkylinkDemo.leaveRoom(function(error, success){ if (error){ console.log('Error happened')); } else{ console.log('Successfully left room'); } });
lockRoom
()
Locks the room to prevent other Peers from joining the room.
Triggers:
lockRoomExample:
SkylinkDemo.lockRoom();
muteStream
options
,
)
Mutes a Local MediaStreams.
Triggers:
peerRestart, peerUpdated, incomingStreamParameters:
-
options
{Object | JSON}The muted options.
-
audioMuted
{Boolean} OptionalDEFAULT: trueIf send a new stream with audio muted.
-
videoMuted
{Boolean} OptionalDEFAULT: trueIf send a new stream with video muted.
-
getEmptyStream
{Boolean} OptionalDEFAULT: falseIf audio or video muted is set and there is no audio or video stream, it will get the stream before muting it.
-
Example:
SkylinkDemo.muteStream({ audioMuted: true, videoMuted: false });
off
eventName
,
callback
,
)
To unregister a callback function from an event.
Parameters:
-
eventName
{String}The Skylink event. See the event list to see what you can unregister.
-
callback
{Function}The callback fired after the event is triggered. Not providing any callback turns all callbacks tied to that event off.
Example:
SkylinkDemo.off('peerJoined', callback);
on
eventName
,
callback
,
)
To register a callback function to an event.
Parameters:
-
eventName
{String}The Skylink event. See the event list to see what you can register.
-
callback
{Function}The callback fired after the event is triggered.
Example:
SkylinkDemo.on('peerJoined', function (peerId, peerInfo) { alert(peerId + ' has joined the room'); });
once
eventName
,
callback
,
[condition]
,
[fireAlways=false]
,
)
To register a callback function to an event that is fired once a condition is met.
Parameters:
-
eventName
{String}The Skylink event. See the event list to see what you can register.
-
callback
{Function}The callback fired after the event is triggered.
-
condition
{Function} OptionalThe provided condition that would trigger this event. If not provided, it will return true when the event is triggered. Return a true to fire the callback.
-
fireAlways
{Boolean} OptionalDEFAULT: falseThe function does not get removed onced triggered, but triggers everytime the event is called.
Example:
SkylinkDemo.once('peerConnectionState', function (state, peerId) { alert('Peer has left'); }, function (state, peerId) { return state === SkylinkDemo.PEER_CONNECTION_STATE.CLOSED; });
refreshConnection
[peerId]
,
)
Refreshes a Peer connection with a connected peer.
Parameters:
-
peerId
{String} OptionalThe peerId of the peer to refresh the connection.
Example:
SkylinkDemo.on('iceConnectionState', function (state, peerId)) { if (iceConnectionState === SkylinkDemo.ICE_CONNECTION_STATE.FAILED) { // Do a refresh SkylinkDemo.refreshConnection(peerId); } });
respondBlobRequest
[peerId]
,
[accept=false]
,
)
Responds to a DataTransfer request initiated by a peer.
Triggers:
dataTransferStateParameters:
-
peerId
{String} OptionalThe peerId of the peer to respond the request to.
-
accept
{Boolean} OptionalDEFAULT: falseThe flag to accept or reject the request.
sendBlobData
data
,
dataInfo
,
[targetPeerId]
,
[callback]
,
)
Starts a DataTransfer request to the peers based on the peerIds provided. Peers have the option to accept or reject the receiving data. DataTransfers are encrypted.
Triggers:
dataTransferStateParameters:
-
data
{Object}The Blob data to be sent over.
-
dataInfo
{JSON}Information required about the data transferred
-
name
{String}The request name (name of the file for example).
-
timeout
{Integer} OptionalDEFAULT: 60The time (in seconds) before the transfer request is cancelled if not answered.
-
size
{Integer}The Blob data size (in bytes).
-
-
targetPeerId
{String} OptionalThe peerId of the peer targeted to receive data. To send to all peers, leave this option blank.
-
callback
{Function} OptionalThe callback fired after data was uploaded.
-
error
{Object} OptionalThe error received in the callback.
-
success
{Object} OptionalThe result received in the callback.
-
Example:
// Example 1: Send file to all peers connected SkylinkDemo.sendBlobData(file, 67);
// Example 2: Send file to individual peer SkylinkDemo.sendBlobData(blob, 87, targetPeerId);
// Example 3: Send file with callback SkylinkDemo.sendBlobData(data,{ name: data.name, size: data.size },function(error, success){ if (error){ console.log('Error happened. Can not send file')); } else{ console.log('Successfully uploaded file'); } });
sendMessage
message
,
[targetPeerId]
,
)
Sends Message object to either a targeted Peer or Broadcasts to all Peers connected in the Room.
- Message is sent using websockets, we don't ensure protection of your message content with this method. Prefer using sendP2PMessage().
Triggers:
incomingMessageParameters:
-
message
{String | JSON}The message data to send.
-
targetPeerId
{String} OptionalPeerId of the peer to send a private message data to. If not specified then send to all peers.
Example:
// Example 1: Send to all peers SkylinkDemo.sendMessage('Hi there!');
// Example 2: Send to a targeted peer SkylinkDemo.sendMessage('Hi there peer!', targetPeerId);
sendP2PMessage
message
,
[targetPeerId]
,
)
Send a Message object via the DataChannel established with peers.
- Maximum size:
16Kb
Triggers:
incomingMessageParameters:
-
message
{String | JSON}The Message object to send.
-
targetPeerId
{String} OptionalThe peerId of the targeted peer to send the Message object only. To send to all peers, leave this option blank.
Example:
// Example 1: Send to all peers SkylinkDemo.sendP2PMessage('Hi there! This is from a DataChannel!');
// Example 2: Send to specific peer SkylinkDemo.sendP2PMessage('Hi there peer! This is from a DataChannel!', targetPeerId);
sendStream
stream
,
[callback]
,
)
Resends a Local MediaStreams. This overrides all previous MediaStreams sent. Provided MediaStream would be automatically detected as unmuted by default.
Triggers:
peerRestart, incomingStreamParameters:
-
stream
{Object | JSON}The stream object or options.
-
audio
{Boolean} OptionalDEFAULT: falseIf send a new stream with audio.
-
stereo
{Boolean} OptionalOption to enable stereo during call. -
mute
{Boolean} OptionalDEFAULT: false If send a new stream with audio muted.
-
-
video
{JSON | Boolean} OptionalDEFAULT: falseOption to allow video stream.
-
resolution
{JSON} OptionalThe resolution of video stream. [Rel: Skylink.VIDEO_RESOLUTION] -
resolution.width
{Integer} OptionalThe video stream resolution width (in px). -
resolution.height
{Integer} OptionalThe video stream resolution height (in px). -
frameRate
{Integer} OptionalThe video stream maximum frameRate. -
mute
{Boolean} OptionalDEFAULT: false If send a new stream with video muted.
-
-
-
callback
{Function} OptionalThe callback fired after stream was sent. Default signature: function(error object, success object)
Example:
// Example 1: Send a stream object instead SkylinkDemo.on('mediaAccessSuccess', function (stream) { SkylinkDemo.sendStream(stream); });
// Example 2: Send stream with getUserMedia automatically called for you SkylinkDemo.sendStream({ audio: true, video: false });
// Example 3: Send stream with getUserMedia automatically called for you // and audio is muted SkylinkDemo.sendStream({ audio: { mute: true }, video: false });
// Example 4: Send stream with callback SkylinkDemo.sendStream({ audio: true, video: true },function(error,success){ if (error){ console.log('Error occurred. Stream was not sent: '+error) } else{ console.log('Stream successfully sent: '+success); } });
setDebugMode
[options=false]
,
)
Sets Skylink in debugging mode to display log stack trace.
- By default, debugging mode is turned off.
Parameters:
-
options
{Boolean | JSON} OptionalDEFAULT: falseIs debugging mode enabled.
-
trace
{Boolean} OptionalDEFAULT: falseIf console output should trace.
-
storeLogs
{Boolean} OptionalDEFAULT: falseIf SkylinkLogs should store the output logs.
-
Example:
// Example 1: just to enable SkylinkDemo.setDebugMode(true); // or SkylinkDemo.setDebugMode();
// Example 2: just to disable SkylinkDemo.setDebugMode(false);
setLogLevel
[logLevel]
,
)
Sets the debugging log level. A log level displays logs of his level and higher: ERROR > WARN > INFO > LOG > DEBUG.
- The default log level is Skylink.LOG_LEVEL.WARN
Parameters:
-
logLevel
{Integer} OptionalThe log level.[Rel: Skylink.Data.LOG_LEVEL]
Example:
//Display logs level: Error, warn, info, log and debug. SkylinkDemo.setLogLevel(SkylinkDemo.LOG_LEVEL.DEBUG);
setUserData
userData
,
)
Update/Set the User custom data. This Data can be a simple string or a JSON data. It is let to user choice to decide how this information must be handled. The Skylink demos provided use this parameter as a string for displaying user name.
- Please note that the custom data would be totally overwritten.
- If you want to modify only some data, please call getUserData() and then modify the information you want individually.
- peerUpdated event fires only if setUserData() is called after joining a room.
Triggers:
peerUpdatedParameters:
-
userData
{JSON | String}User custom data.
Example:
// Example 1: Intial way of setting data before user joins the room SkylinkDemo.setUserData({ displayName: 'Bobby Rays', fbUserId: '1234' });
// Example 2: Way of setting data after user joins the room var userData = SkylinkDemo.getUserData(); userData.displayName = 'New Name'; userData.fbUserId = '1234'; SkylinkDemo.setUserData(userData);
stopStream
()
Stops all MediaStreams(s) playback and streaming.
unlockRoom
()
Unlocks the room to allow other Peers to join the room.
Triggers:
lockRoomExample:
SkylinkDemo.unlockRoom();
log.debug
()
Outputs a debug log in the console.
Parameters:
-
message
{Array | String}or the message
-
object
{String | Object} OptionalThe log object.
Example:
// Logging for message log.debug('This is my message', object);
log.error
()
Outputs an error log in the console.
Parameters:
-
message
{Array | String}or the message
-
object
{String | Object} OptionalThe log object. // Logging for external information log.error('There has been an error', object);
log.info
()
Outputs an info log in the console.
Parameters:
-
message
{Array | String}or the message
-
object
{String | Object} OptionalThe log object.
Example:
// Logging for message log.debug('This is my message', object);
log.log
()
Outputs a normal log in the console.
Parameters:
-
message
{Array | String}or the message
-
object
{String | Object} OptionalThe log object.
Example:
// Logging for message log.log('This is my message', object);
log.warn
()
Outputs a warning log in the console.
Parameters:
-
message
{Array | String}or the message
-
object
{String | Object} OptionalThe log object.
Example:
// Logging for message log.debug('Here\'s a warning. Please do xxxxx to resolve this issue', object);
SkylinkLogs.clearAllLogs
()
Clear all the stored logs.
SkylinkLogs.getLogs
()
Gets the list of logs
Parameters:
-
logLevel
{Integer} OptionalThe log level that getLogs() should return. If not provided, it getLogs() will return all logs from all levels. [Rel: Skylink.LOG_LEVEL]
Returns:
The array of logs
SkylinkLogs.printAllLogs
()
Print out all the store logs in console.
_audioFallback
Attribute Type: {Boolean}
Fallback to audio call if audio and video is required.
Default value:
false
_CHUNK_FILE_SIZE
Attribute Type: {Integer}
The size of a chunk that DataTransfer should chunk a Blob into.
_dataChannels
Attribute Type: {JSON}
Stores the DataChannel received or created with peers.
Keys:
-
<peerId>
{Object}The DataChannel associated with peer.
_dataTransfersTimeout
Attribute Type: {JSON}
Stores all the setTimeout
objects for each
request received.
_DC_PROTOCOL_TYPE
Attribute Type: {JSON}
The DataTransfer protocol list. The data
object is an
indicator of the expected parameters to be given and received.
Keys:
-
WRQ
{String}Send to initiate a DataTransfer request.
-
data
{JSON}Expected WRQ data object format.
-
agent
{String}The peer's browser agent. -
version
{Integer}The peer's browser version. -
name
{String}The Blob name. -
size
{Integer}The Blob size. -
chunkSize
{Integer}The Blob chunk size expected to receive. -
timeout
{Integer}The timeout to wait for the packet response. -
isPrivate
{Boolean}The flag to indicate if the data is sent as a private request. -
sender
{String}The sender's peerId. -
type
{String}Protocol step:"WRQ"
.
-
-
-
ACK
{String}Send to acknowledge the DataTransfer request.
-
data
{JSON}Expected ACK data object format.
-
ackN
{String}The current index of the Blob chunk array to receive from.0
The request is accepted and sender sends the first packet.>0
The current packet number from Blob array being sent.-1
RThe request is rejected and sender cancels the transfer.
-
sender
{String}The sender's peerId. -
type
{String}Protocol step:"ACK"
.
-
-
data
{Object}Expected DATA data object. Look at the available types in [Rel: DATA_TRANSFER_DATA_TYPE]
-
-
DATA
{String}Send as the raw Blob chunk data based on the
ackN
received.- Handle the logic based on parsing the data received as JSON. If it should fail,
the expected data received should be a
DATA
request.
- Handle the logic based on parsing the data received as JSON. If it should fail,
the expected data received should be a
-
CANCEL
{String}Send to cancel or terminate a DataTransfer.
-
data
{Array}CANCEL data object format.
-
name
{String}The Blob data name. -
content
{String}The reason for termination. -
sender
{String}The sender's peerId. -
type
{String}Protocol step:"CANCEL"
.
-
-
-
ERROR
{String}Sent when a timeout waiting for a DataTransfer response has reached its limit.
-
data
{Array}Expected ERROR data object format.
-
name
{String}The Blob data name. -
content
{String}The error message. -
isUploadError
{Boolean} OptionalThe flag to indicate if the exception is thrown from the sender or receiving peer. -
sender
{String}The sender's peerId. -
type
{String}Protocol step:"ERROR"
.
-
-
-
MESSAGE
{String}Sends a Message object.
-
data
{JSON}Expected MESSAGE data object format.
-
target
{String}The peerId of the peer to send the Message to. -
data
{String | JSON}The Message object to send. -
sender
{String}The sender's peerId. -
type
{String}Protocol step:"MESSAGE"
.
-
-
_defaultRoom
Attribute Type: {String}
The default room that the user connects to if no room is provided in joinRoom().
_defaultStreamSettings
Attribute Type: {JSON}
The user stream settings.
Keys:
-
audio
{Boolean | JSON} OptionalIf user enables audio, this is the default setting.
-
stereo
{Boolean} OptionalEnabled stereo or not
-
-
video
{Boolean | JSON} OptionalIf user enables video, this is the default setting.
-
resolution
{JSON} Optional[Rel: Skylink.VIDEO_RESOLUTION]
-
width
{Integer} OptionalVideo width -
height
{Integer} OptionalVideo height
-
-
frameRate
{Integer} OptionalMaximum frameRate of Video
-
-
bandwidth
{String}Bandwidth settings.
-
audio
{String}Audio default Bandwidth
-
video
{String}Video default Bandwidth
-
data
{String}Data default Bandwidth.
-
_enableDataChannel
Attribute Type: {Boolean}
The flag that indicates if DataChannel should be enabled.
Default value:
true
_enableDebugMode
Attribute Type: {Boolean}
The current state if debugging mode is enabled.
Default value:
false
_enableDebugStack
Attribute Type: {Boolean}
The current state if debugging mode should store the logs in SkylinkLogs.
Default value:
false
_enableDebugTrace
Attribute Type: {Boolean}
The current state if debugging mode should print the trace in every log information.
Default value:
false
_enableIceTrickle
Attribute Type: {Boolean}
The flag that indicates if ICE trickle is enabled.
Default value:
true
_enableSTUN
Attribute Type: {Boolean}
The flag that indicates if STUN server is to be used.
Default value:
true
_enableTURN
Attribute Type: {Boolean}
The flag that indicates if TURN server is to be used.
Default value:
true
_forceSSL
Attribute Type: {Boolean}
Force an SSL connection to signalling and API server.
Default value:
false
_getUserMediaSettings
Attribute Type: {JSON}
The getUserMedia settings parsed from _streamSettings.
Keys:
-
audio
{Boolean | JSON} OptionalThis call requires audio.
-
video
{Boolean | JSON} OptionalThis call requires video.
-
mandatory.maxHeight
{Integer} OptionalVideo maximum width.
-
mandatory.maxWidth
{Integer} OptionalVideo maximum height.
-
mandatory.maxFrameRate
{Integer} OptionalMaximum frameRate of Video.
-
optional
{Array} OptionalThe getUserMedia options.
-
_mediaStreamsStatus
Attribute Type: {JSON}
The user MediaStream(s) status.
Keys:
-
audioMuted
{Boolean} OptionalIs user's audio muted.
-
videoMuted
{Boolean} OptionalIs user's vide muted.
_MOZ_CHUNK_FILE_SIZE
Attribute Type: {Integer}
The size of a chunk that DataTransfer should chunk a Blob into specifically for Firefox based browsers.
- Tested: Sends
49152
kb | Receives16384
kb.
_onceEvents
Attribute Type: {JSON}
Events with callbacks that would be fired only once once condition is met.
_path
Attribute Type: {String}
The path that user is currently connect to.
- NOTE ALEX: check if last char is '/'
Default value:
Skylink._serverPath
_peerCandidatesQueue
Attribute Type: {Object}
Stores the list of queued ICE Candidates received before handshaking is completed.
_peerConnectionHealthTimers
Attribute Type: {JSON}
Stores the list of setTimeout
awaiting for successful connection.
_peerHSPriorities
Attribute Type: {JSON}
Stores the list of handshaking weights received that would be compared against to indicate if User should send an "offer" or Peer should.
_readyState
Attribute Type: {Integer}
The current Skylink ready state change. [Rel: Skylink.READY_STATE_CHANGE]
_room
Attribute Type: {JSON}
The room connection information.
Keys:
-
id
{String}The roomId of the room user is connected to.
-
token
{String}The token of the room user is connected to.
-
startDateTime
{String}The startDateTime in ISO string format of the room.
-
duration
{String}The duration of the room.
-
connection
{JSON}Connection constraints and configuration.
-
peerConstraints
{JSON}The peerconnection constraints.
-
peerConfig
{JSON}The peerconnection configuration.
-
offerConstraints
{JSON}The offer constraints.
-
sdpConstraints
{JSON}The sdp constraints.
-
_roomCredentials
Attribute Type: {String}
The credentials required to set the start date and time and the duration.
_roomServer
Attribute Type: {String}
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.
Default value:
'//api.temasys.com.sg'
_roomStart
Attribute Type: {String}
The static room's meeting starting date and time.
- The value is in ISO formatted string.
_selectedRoom
Attribute Type: {String}
The room that the user is currently connected to.
Default value:
Skylink._defaultRoom
_SIG_MESSAGE_TYPE
Attribute Type: {JSON}
The Message protocol list. The message
object is an
indicator of the expected parameters to be given and received.
Keys:
-
JOIN_ROOM
{String}Send to initiate the connection to the Room.
-
message
{JSON}Expected JOIN_ROOM data object format.
-
rid
{String}Received rid from API web-server. -
uid
{String}Received uid from API web-server. -
cid
{String}Received cid from API web-server. -
userCred
{String}Received userCred from API web-server. -
timeStamp
{String}Received timeStamp from API web-server. -
apiOwner
{String}Received apiOwner from API web-server. -
roomCred
{String}Received roomCred from API web-server. -
start
{String}Received start from API web-server. -
len
{String}Received duration from API web-server. -
type
{String}Protocol step:"joinRoom"
.
-
-
-
IN_ROOM
{String}Received as a response from server that User has joined the Room.
-
message
{JSON}Expected IN_ROOM data object format.
-
rid
{String}The roomId of the connected room. -
sid
{String}The User's userId. -
pc_config
{JSON}The Peer connection iceServers configuration. -
type
{String}Protocol step:"inRoom"
.
-
-
-
ENTER
{String}Broadcasts to any Peers connected to the room to intiate a Peer connection.
-
message
{JSON}Expected ENTER data object format.
-
rid
{String}The roomId of the connected Room. -
mid
{String}The sender's peerId / userId. -
receiveOnly
{Boolean} OptionalThe flag to prevent Peers from sending any Stream to the User but receive User's stream only. -
agent
{String}The Peer's browser agent. -
version
{String}The Peer's browser version. -
userInfo
{String}The Peer's information. -
userInfo.settings
{JSON}The stream settings -
userInfo.settings.audio
{Boolean | JSON} OptionalThe flag to indicate if audio is enabled in the connection or not. -
userInfo.settings.audio.stereo
{Boolean} OptionalThe flag to indiciate if stereo should be enabled in OPUS connection. -
userInfo.settings.video
{Boolean | JSON} OptionalThe flag to indicate if video is enabled in the connection or not. -
userInfo.settings.video.resolution
{JSON} Optional[Rel: Skylink.VIDEO_RESOLUTION] The video stream resolution. -
userInfo.settings.video.resolution.width
{Integer} OptionalThe video stream resolution width. -
userInfo.settings.video.resolution.height
{Integer} OptionalThe video stream resolution height. -
userInfo.settings.video.frameRate
{Integer} OptionalThe video stream maximum frame rate. -
userInfo.mediaStatus
{JSON}The Peer's Stream status. This is used to indicate if connected video or audio stream is muted. -
userInfo.mediaStatus.audioMuted
{Boolean} OptionalThe flag to indicate that the Peer's audio stream is muted or disabled. -
userInfo.mediaStatus.videoMuted
{Boolean} OptionalThe flag to indicate that the Peer's video stream is muted or disabled. -
userInfo.userData
{String | JSON}The custom User data. -
type
{String}Protocol step:"enter"
.
-
-
-
WELCOME
{String}Send as a response to Peer's enter received. User starts creating offer to the Peer.
-
message
{JSON}Expected WELCOME data object format.
-
rid
{String}The roomId of the connected Room. -
mid
{String}The sender's peerId / userId. -
receiveOnly
{Boolean} OptionalThe flag to prevent Peers from sending any Stream to the User but receive User's stream only. -
enableIceTrickle
{Boolean} OptionalThe flag to forcefully enable or disable ICE Trickle for the Peer connection. -
enableDataChannel
{Boolean} OptionalThe flag to forcefully enable or disable ICE Trickle for the Peer connection. -
agent
{String}The Peer's browser agent. -
version
{String}The Peer's browser version. -
userInfo
{String}The Peer's information. -
userInfo.settings
{JSON}The stream settings -
userInfo.settings.audio
{Boolean | JSON} OptionalThe flag to indicate if audio is enabled in the connection or not. -
userInfo.settings.audio.stereo
{Boolean} OptionalThe flag to indiciate if stereo should be enabled in OPUS connection. -
userInfo.settings.video
{Boolean | JSON} OptionalThe flag to indicate if video is enabled in the connection or not. -
userInfo.settings.video.resolution
{JSON} Optional[Rel: Skylink.VIDEO_RESOLUTION] The video stream resolution. -
userInfo.settings.video.resolution.width
{Integer} OptionalThe video stream resolution width. -
userInfo.settings.video.resolution.height
{Integer} OptionalThe video stream resolution height. -
userInfo.settings.video.frameRate
{Integer} OptionalThe video stream maximum frame rate. -
userInfo.mediaStatus
{JSON}The Peer's Stream status. This is used to indicate if connected video or audio stream is muted. -
userInfo.mediaStatus.audioMuted
{Boolean} OptionalThe flag to indicate that the Peer's audio stream is muted or disabled. -
userInfo.mediaStatus.videoMuted
{Boolean} OptionalThe flag to indicate that the Peer's video stream is muted or disabled. -
userInfo.userData
{String | JSON}The custom User data. -
target
{String}The peerId of the peer to respond the enter message to. -
weight
{Integer}The priority weight of the message. This is required when two Peers receives each other's welcome message, hence disrupting the handshaking to be incorrect. With a generated weight usually done by invokingDate.UTC()
, this would check against the received weight and generated weight for the Peer to prioritize who should create or receive the offer.>=0
An ongoing weight priority check is going on.Weight priority message.-1
Enforce create offer to happen without any priority weight check.-2
Enforce create offer and re-creating of Peer connection to happen without any priority weight check.
-
type
{String}Protocol step:"welcome"
.
-
-
-
OFFER
{String}Send when
createOffer
is completed and generated.-
message
{JSON}Expected OFFER data object format.
-
rid
{String}The roomId of the connected room. -
mid
{String}The sender's peerId. -
sdp
{String}The generated offer session description. -
type
{String}Protocol step:"offer"
.
-
-
-
ANSWER
{String}Send as a response to Peer's offer Message after
createAnswer
is called.-
message
{JSON}Expected ANSWER data object format.
-
rid
{String}The roomId of the connected room. -
sdp
{String}The generated answer session description. -
mid
{String}The sender's peerId. -
type
{String}Protocol step:"answer"
.
-
-
-
CANDIDATE
{String}Send when an ICE Candidate is generated.
-
message
{JSON}Expected CANDIDATE data object format.
-
rid
{String}The roomId of the connected room. -
mid
{String}The sender's peerId. -
sdp
{String}The ICE Candidate's session description. -
target
{String}The peerId of the targeted Peer. -
id
{String}The ICE Candidate's id. -
candidate
{String}The ICE Candidate's candidate object. -
label
{String}The ICE Candidate's label. -
type
{String}Protocol step:"candidate"
.
-
-
-
BYE
{String}Received as a response from server that a Peer has left the Room.
-
message
{JSON}Expected BYTE data object format.
-
rid
{String}The roomId of the connected Room. -
mid
{String}The peerId of the Peer that has left the Room. -
type
{String}Protocol step:"bye"
.
-
-
-
REDIRECT
{String}Received as a warning from server when User is rejected or is jamming the server.
-
message
{JSON}Expected REDIRECT data object format.
-
rid
{String}The roomId of the connected Room. -
info
{String}The server's message. -
action
{String}The action that User has to take on. [Rel: Skylink.SYSTEM_ACTION] -
reason
{String}The reason of why the action is worked upon. [Rel: Skylink.SYSTEM_ACTION_REASON] -
type
{String}Protocol step:"redirect"
.
-
-
-
UPDATE_USER
{String}Broadcast when a User's information is updated to reflect the the changes on Peer's end.
-
message
{JSON}Expected UPDATE_USER data object format.
-
rid
{String}The roomId of the connected Room. -
mid
{String}The sender's peerId. -
userData
{JSON | String}The updated User data. -
type
{String}Protocol step:"updateUserEvent"
.
-
-
-
ROOM_LOCK
{String}Broadcast to change the Room lock status.
-
message
{JSON}Expected ROOM_LOCK data object format.
-
rid
{String}The roomId of the connected Room. -
mid
{String}The sender's peerId. -
lock
{String}The flag to indicate if the Room is locked or not -
type
{String}Protocol step:"roomLockEvent"
.
-
-
-
MUTE_VIDEO
{String}Broadcast when User's video stream is muted or unmuted.
-
message
{JSON}Expected MUTE_VIDEO data object format.
-
rid
{String}The roomId of the connected Room. -
mid
{String}The sender's peerId. -
muted
{String}The flag to indicate if the User's video stream is muted or not. -
type
{String}Protocol step:"muteVideoEvent"
.
-
-
-
MUTE_AUDIO
{String}Broadcast when User's audio stream is muted or unmuted.
-
message
{JSON}Expected MUTE_AUDIO data object format.
-
rid
{String}The roomId of the connected Room. -
mid
{String}The sender's peerId. -
muted
{String}The flag to indicate if the User's audio stream is muted or not. -
type
{String}Protocol step:"muteAudioEvent"
.
-
-
-
PUBLIC_MESSAGE
{String}Broadcasts a Message object to all Peers in the Room.
-
message
{JSON}Expected PUBLIC_MESSAGE data object format.
-
data
{JSON | String}The Message object. -
rid
{String}The roomId of the connected Room. -
cid
{String}The credentialId of the connected Room. -
mid
{String}The sender's peerId. -
type
{String}Protocol step:"public"
.
-
-
-
PRIVATE_MESSAGE
{String}Sends a Message object to a Peer in the Room.
-
message
{JSON}The message object.
-
data
{JSON | String}The Message object. -
rid
{String}The roomId of the connected Room. -
cid
{String}The credentialId of the connected Room. -
mid
{String}The sender's peerId. -
target
{String}The peerId of the targeted Peer. -
type
{String}Protocol step:"private"
.
-
-
-
RESTART
{String}Sends when a Peer connection is restarted.
-
message
{JSON}Expected RESTART data object format.
-
rid
{String}The roomId of the connected Room. -
mid
{String}The sender's peerId / userId. -
receiveOnly
{Boolean} OptionalThe flag to prevent Peers from sending any Stream to the User but receive User's stream only. -
enableIceTrickle
{Boolean} OptionalThe flag to forcefully enable or disable ICE Trickle for the Peer connection. -
enableDataChannel
{Boolean} OptionalThe flag to forcefully enable or disable ICE Trickle for the Peer connection. -
agent
{String}The Peer's browser agent. -
version
{String}The Peer's browser version. -
userInfo
{String}The Peer's information. -
userInfo.settings
{JSON}The stream settings -
userInfo.settings.audio
{Boolean | JSON} OptionalThe flag to indicate if audio is enabled in the connection or not. -
userInfo.settings.audio.stereo
{Boolean} OptionalThe flag to indiciate if stereo should be enabled in OPUS connection. -
userInfo.settings.video
{Boolean | JSON} OptionalThe flag to indicate if video is enabled in the connection or not. -
userInfo.settings.video.resolution
{JSON} Optional[Rel: Skylink.VIDEO_RESOLUTION] The video stream resolution. -
userInfo.settings.video.resolution.width
{Integer} OptionalThe video stream resolution width. -
userInfo.settings.video.resolution.height
{Integer} OptionalThe video stream resolution height. -
userInfo.settings.video.frameRate
{Integer} OptionalThe video stream maximum frame rate. -
userInfo.mediaStatus
{JSON}The Peer's Stream status. This is used to indicate if connected video or audio stream is muted. -
userInfo.mediaStatus.audioMuted
{Boolean} OptionalThe flag to indicate that the Peer's audio stream is muted or disabled. -
userInfo.mediaStatus.videoMuted
{Boolean} OptionalThe flag to indicate that the Peer's video stream is muted or disabled. -
userInfo.userData
{String | JSON}The custom User data. -
target
{String}The peerId of the peer to respond the enter message to. -
type
{String}Protocol step:"restart"
.
-
-
-
STREAM
{String}Broadcast when a Stream has ended. This is temporal.
-
message
{JSON}Expected STREAM data object format.
-
rid
{String}The roomId of the connected Room. -
mid
{String}The peerId of the sender. -
status
{String}The MediaStream status.ended
: MediaStream has ended
-
type
{String}Protocol step:"stream"
.
-
-
-
GROUP
{String}Messages are bundled together when messages are sent too fast to prevent server redirects over sending less than 1 second interval.
-
message
{JSON}Expected GROUP data object format.
-
list
{Array}The list of bundled messages. -
list.<message>
{Array}The Message object. -
type
{String}Protocol step:"group"
.
-
-
_signalingServerPort
Attribute Type: {Integer}
The signaling server port to connect to.
Default value:
https: = 443, http = 80
_signalingServerProtocol
Attribute Type: {String}
The signaling server protocol to use.
https:
- Default port is
443
. - Fallback port is
3443
.
- Default port is
http:
- Default port is
80
. - Fallback port is
3000
.
- Default port is
_socketTimeout
Attribute Type: {Integer}
The socket connection timeout
0
Uses the default timeout from socket.io20000
ms.>0
Uses the user set timeout
Default value:
0
_socketUseXDR
Attribute Type: {Boolean}
The socket connection to use XDomainRequest.
Default value:
false
_streamSettings
Attribute Type: {JSON}
The user stream settings.
Keys:
-
audio
{Boolean | JSON} OptionalThis call requires audio
-
stereo
{Boolean} OptionalEnabled stereo or not
-
-
video
{Boolean | JSON} OptionalThis call requires video
-
resolution
{JSON} Optional[Rel: Skylink.VIDEO_RESOLUTION]
-
width
{Integer} OptionalVideo width -
height
{Integer} OptionalVideo height
-
-
frameRate
{Integer} OptionalMaximum frameRate of Video
-
-
bandwidth
{String} OptionalBandwidth settings
-
audio
{String} OptionalAudio Bandwidth
-
video
{String} OptionalVideo Bandwidth
-
data
{String} OptionalData Bandwidth.
-
_STUNSSL
Attribute Type: {Boolean}
source/ice-connection.js:97
Available since 0.5.4
The flag that indicates if SSL is used in STUN server connection.
Default value:
false
_TURNSSL
Attribute Type: {Boolean}
source/ice-connection.js:112
Available since 0.5.4
The flag that indicates if SSL is used in TURN server connection.
Default value:
false
_TURNTransport
Attribute Type: {String}
The option of transport protocol for TURN servers.
Default value:
Skylink.TURN_TRANSPORT.ANY
_user
Attribute Type: {JSON}
Stores the User information, credential and the local stream(s).
Keys:
-
uid
{String}The user's session id.
-
sid
{String}The user's secret id. This is the id used as the peerId.
-
timestamp
{String}The user's timestamp.
-
token
{String}The user's access token.
CANDIDATE_GENERATION_STATE
Attribute Type: {JSON}
The list of ICE candidate generation states that would be triggered.
Keys:
-
NEW
{String}The object was just created, and no networking has occurred yet.
-
GATHERING
{String}The ICE engine is in the process of gathering candidates for connection.
-
COMPLETED
{String}The 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
Attribute Type: {JSON}
The list of DataChannel states that would be trigged.
Keys:
-
CONNECTING
{String}The DataChannel is attempting to establish a connection.
-
OPEN
{String}The DataChannel connection is established.
-
CLOSING
{String}The DataChannel is closing the connection.
-
CLOSED
{String}The DataChannel connection is closed.
-
ERROR
{String}The DataChannel is thrown with an exception during connection.
DATA_TRANSFER_DATA_TYPE
Attribute Type: {JSON}
The list of DataTransfer native data types that would be transfered with.
- Not Implemented:
ARRAY_BUFFER
,BLOB
.
Keys:
-
BINARY_STRING
{String}BinaryString data type.
-
ARRAY_BUFFER
{String}ArrayBuffer data type.
-
BLOB
{String}Blob data type.
DATA_TRANSFER_STATE
Attribute Type: {JSON}
The list of DataTransfer states that would be triggered.
Keys:
-
UPLOAD_REQUEST
{String}A DataTransfer request to start a transfer is received.
-
UPLOAD_STARTED
{String}The request has been accepted and upload is starting.
-
DOWNLOAD_STARTED
{String}The request has been accepted and download is starting.
-
UPLOADING
{String}An ongoing upload DataTransfer is occuring.
-
DOWNLOADING
{String}An ongoing download DataTransfer is occuring.
-
UPLOAD_COMPLETED
{String}The upload is completed.
-
DOWNLOAD_COMPLETED
{String}The download is completed.
-
REJECTED
{String}A DataTransfer request is rejected by a peer.
-
ERROR
{String}DataTransfer has waiting longer than timeout is specified. DataTransfer is aborted.
DATA_TRANSFER_TYPE
Attribute Type: {JSON}
The list of DataTransfer streamming types to indicate an upload stream or download stream.
Keys:
-
UPLOAD
{String}An upload stream.
-
DOWNLOAD
{String}A download stream.
HANDSHAKE_PROGRESS
Attribute Type: {JSON}
The list of handshake progress steps that would be triggered.
Keys:
-
ENTER
{String}Step 1. Received "enter" from peer.
-
WELCOME
{String}Step 2. Received "welcome" from peer.
-
OFFER
{String}Step 3. Received "offer" from peer.
-
ANSWER
{String}Step 4. Received "answer" from peer.
-
ERROR
{String}Error state.
ICE_CONNECTION_STATE
Attribute Type: {JSON}
The list of ICE Connection states that would be triggered.
Keys:
-
STARTING
{String}The ICE agent is gathering addresses and/or waiting for remote candidates to be supplied.
-
CHECKING
{String}The 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.
-
CONNECTED
{String}The 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.
-
COMPLETED
{String}The ICE agent has finished gathering and checking and found a connection for all components.
-
FAILED
{String}The ICE agent is finished checking all candidate pairs and failed to find a connection for at least one component.
-
DISCONNECTED
{String}Liveness 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.
-
CLOSED
{String}The ICE agent has shut down and is no longer responding to STUN requests.
log
Attribute Type: {JSON}
Logs all the console information.
Keys:
-
debug
{Function}For debug mode.
-
log
{Function}For log mode.
-
info
{Function}For info mode.
-
warn
{Function}For warn mode.
-
serror
{Function}For error mode.
LOG_LEVEL
Attribute Type: {JSON}
The log levels.
- Order from highest to lowest is: error > warn > info > log > debug.
- A log level displays logs of his level and higher (e.g warn level displays warn and error).
Keys:
-
DEBUG
{Integer}Level 5. Shows debug logs.
-
LOG
{Integer}Level 4. Shows normal logs.
-
INFO
{Integer}Level 3. Show informational logs related to user.
-
WARN
{Integer}Level 2. Shows warnings.
-
ERROR
{Integer}Level 1. Shows the errors that are thrown during execution.
PEER_CONNECTION_STATE
Attribute Type: {JSON}
The list of Peer connection states that would be triggered.
Keys:
-
STABLE
{String}There is no handshaking in progress. This state occurs when handshaking has just started or close.
-
HAVE_LOCAL_OFFER
{String}The session description "offer" is generated and to be sent.
-
HAVE_REMOTE_OFFER
{String}The session description "offer" is received. The handshaking has been completed.
-
CLOSED
{String}The connection is closed.
READY_STATE_CHANGE
Attribute Type: {JSON}
The list of Room initialization readyStates. This indicates if the required API information has been retrieved successfully from the API server for the signaling connection.
Keys:
-
INIT
{Integer}The initialization state.
-
LOADING
{Integer}The API information is retrieving in progress.
-
COMPLETED
{Integer}The API information has been retrieved.
-
ERROR
{Integer}An error has occurred when retrieving API information.
READY_STATE_CHANGE_ERROR
Attribute Type: {JSON}
The list of ready state change errors.
- These are the error states from the error object error code.
- ROOM_LOCKED is deprecated in 0.5.2. Please use Skylink/:attr
- The states that would occur are:
Keys:
-
API_INVALID
{Integer}Api Key provided does not exist.
-
API_DOMAIN_NOT_MATCH
{Integer}Api Key used in domain does not match.
-
API_CORS_DOMAIN_NOT_MATCH
{Integer}Api Key used in CORS domain does not match.
-
API_CREDENTIALS_INVALID
{Integer}Api Key credentials does not exist.
-
API_CREDENTIALS_NOT_MATCH
{Integer}Api Key credentials does not match what is expected.
-
API_INVALID_PARENT_KEY
{Integer}Api Key does not have a parent key nor is a root key.
-
API_NOT_ENOUGH_CREDIT
{Integer}Api Key does not have enough credits to use.
-
API_NOT_ENOUGH_PREPAID_CREDIT
{Integer}Api Key does not have enough prepaid credits to use.
-
API_FAILED_FINDING_PREPAID_CREDIT
{Integer}Api Key preapid payments does not exist.
-
API_NO_MEETING_RECORD_FOUND
{Integer}Api Key does not have a meeting record at this timing. This occurs when Api Key is a static one.
-
ROOM_LOCKED
{Integer}Room is locked.
-
NO_SOCKET_IO
{Integer}No socket.io dependency is loaded to use.
-
NO_XMLHTTPREQUEST_SUPPORT
{Integer}Browser does not support XMLHttpRequest to use.
-
NO_WEBRTC_SUPPORT
{Integer}Browser does not have WebRTC support.
-
NO_PATH
{Integer}No path is loaded yet.
-
INVALID_XMLHTTPREQUEST_STATUS
{Integer}Invalid XMLHttpRequest when retrieving information.
REGIONAL_SERVER
Attribute Type: {JSON}
The list of available regional servers.
- This is for developers to set the nearest region server for Skylink to connect to for faster connectivity.
- The available regional servers are:
Keys:
-
APAC1
{String}Asia pacific server 1.
-
US1
{String}server 1.
SOCKET_ERROR
Attribute Type: {JSON}
The list of channel connection error.
- The errors that would occur are:
Keys:
-
CONNECTION_FAILED
{Integer}The connection failed. Up to user's defined reconnection attempts to decide on a reconnection.
-
RECONNECTION_FAILED
{String}The reconnection failed. Up to user's defined reconnection attempts to decide on another reconnection.
-
CONNECTION_ABORTED
{String}No reconnection specified. Connection is aborted.
-
RECONNECTION_ABORTED
{String}All reconnection attempts have failed. Reconnection is aborted.
-
RECONNECTION_ATTEMPT
{String}A reconnection attempt has been fired.
SOCKET_FALLBACK
Attribute Type: {JSON}
The list of channel connection fallback states.
- The fallback states that would occur are:
Keys:
-
NON_FALLBACK
{String}Non-fallback state,
-
FALLBACK_PORT
{String}Fallback to non-ssl port for channel re-try.
-
FALLBACK_PORT_SSL
{String}Fallback to ssl port for channel re-try.
-
LONG_POLLING
{String}Fallback to non-ssl long-polling.
-
LONG_POLLING_SSL
{String}Fallback to ssl port for long-polling.
SYSTEM_ACTION
Attribute Type: {JSON}
The list of signaling warnings that would be received.
Keys:
-
WARNING
{String}Server warning to User if actions are not taken, User would be kicked out of the Room.
-
REJECT
{String}Server has kicked User out of the Room.
SYSTEM_ACTION_REASON
Attribute Type: {JSON}
The list of signaling actions to be taken upon received.
Keys:
-
FAST_MESSAGE
{String}User is not alowed to send too quick messages as it is used to prevent jam.
-
ROOM_LOCKED
{String}Room is locked and User is rejected from joining the Room.
-
ROOM_FULL
{String}The target Peers in a persistent room is full.
-
DUPLICATED_LOGIN
{String}The User is re-attempting to connect again with an userId that has been used.
-
SERVER_ERROR
{String}Server has an error.
-
VERIFICATION
{String}Verification is incomplete for roomId provided.
-
EXPIRED
{String}Persistent meeting. Room has expired and user is unable to join the room.
-
ROOM_CLOSED
{String}The persistent room is closed as it has been expired.
-
ROOM_CLOSING
{String}The persistent room is closing.
-
OVER_SEAT_LIMIT
{String}The seat limit has been reached.
TURN_TRANSPORT
Attribute Type: {JSON}
The list of TURN server transports.
Keys:
-
TCP
{String}Use only TCP transport option.
-
UDP
{String}Use only UDP transport option.
-
ANY
{String}Use both TCP and UDP transport option.
-
NONE
{String}Set no transport option in TURN servers
VIDEO_RESOLUTION
Attribute Type: {JSON}
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:
-
QQVGA
{JSON}QQVGA resolution.
-
width
{Integer}160
-
height
{Integer}120
-
aspectRatio
{String}4:3
-
-
HQVGA
{JSON}HQVGA resolution.
-
width
{Integer}240
-
height
{Integer}160
-
aspectRatio
{String}3:2
-
-
QVGA
{JSON}QVGA resolution.
-
width
{Integer}320
-
height
{Integer}180
-
aspectRatio
{String}4:3
-
-
WQVGA
{JSON}WQVGA resolution.
-
width
{Integer}384
-
height
{Integer}240
-
aspectRatio
{String}16:10
-
-
HVGA
{JSON}HVGA resolution.
-
width
{Integer}480
-
height
{Integer}320
-
aspectRatio
{String}3:2
-
-
VGA
{JSON}VGA resolution.
-
width
{Integer}640
-
height
{Integer}360
-
aspectRatio
{String}4:3
-
-
WVGA
{JSON}WVGA resolution.
-
width
{Integer}768
-
height
{Integer}480
-
aspectRatio
{String}16:10
-
-
FWVGA
{JSON}FWVGA resolution.
-
width
{Integer}854
-
height
{Integer}480
-
aspectRatio
{String}16:9
-
-
SVGA
{JSON}SVGA resolution.
-
width
{Integer}800
-
height
{Integer}600
-
aspectRatio
{String}4:3
-
-
DVGA
{JSON}DVGA resolution.
-
width
{Integer}960
-
height
{Integer}640
-
aspectRatio
{String}3:2
-
-
WSVGA
{JSON}WSVGA resolution.
-
width
{Integer}1024
-
height
{Integer}576
-
aspectRatio
{String}16:9
-
-
HD
{JSON}HD resolution.
-
width
{Integer}1280
-
height
{Integer}720
-
aspectRatio
{String}16:9
-
-
HDPLUS
{JSON}HDPLUS resolution.
-
width
{Integer}1600
-
height
{Integer}900
-
aspectRatio
{String}16:9
-
-
FHD
{JSON}FHD resolution.
-
width
{Integer}1920
-
height
{Integer}1080
-
aspectRatio
{String}16:9
-
-
QHD
{JSON}QHD resolution.
-
width
{Integer}2560
-
height
{Integer}1440
-
aspectRatio
{String}16:9
-
-
WQXGAPLUS
{JSON}WQXGAPLUS resolution.
-
width
{Integer}3200
-
height
{Integer}1800
-
aspectRatio
{String}16:9
-
-
UHD
{JSON}UHD resolution.
-
width
{Integer}3840
-
height
{Integer}2160
-
aspectRatio
{String}16:9
-
-
UHDPLUS
{JSON}UHDPLUS resolution.
-
width
{Integer}5120
-
height
{Integer}2880
-
aspectRatio
{String}16:9
-
-
FUHD
{JSON}FUHD resolution.
-
width
{Integer}7680
-
height
{Integer}4320
-
aspectRatio
{String}16:9
-
-
QUHD
{JSON}resolution.
-
width
{Integer}15360
-
height
{Integer}8640
-
aspectRatio
{String}16:9
-
candidateGenerationState
Event fired when an ICE gathering state has changed.
Event Payload:
-
state
{String}The ice candidate generation state. [Rel: Skylink.CANDIDATE_GENERATION_STATE]
-
peerId
{String}PeerId 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:
-
error
{Object | String}Error message or object thrown.
channelMessage
Event fired when the socket connection received a message from the signaling server.
Event Payload:
-
message
{JSON}
channelOpen
Event fired when the socket connection to the signaling server is open.
channelRetry
Event fired when the socket re-tries to connection with fallback ports.
Event Payload:
-
fallbackType
{String}The type of fallback [Rel: Skylink.SOCKET_FALLBACK]
-
currentAttempt
{Integer}The current attempt of the fallback re-try attempt.
dataChannelState
Event fired when a peer's datachannel state has changed.
Event Payload:
-
state
{String}The datachannel state. [Rel: Skylink.DATA_CHANNEL_STATE]
-
peerId
{String}PeerId 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:
-
state
{String}The data transfer state. [Rel: Skylink.DATA_TRANSFER_STATE]
-
transferId
{String}TransferId of the data.
-
peerId
{String}PeerId of the peer that has a data transfer state change.
-
transferInfo
{JSON}Data transfer information.
-
percentage
{JSON}The percetange of data being uploaded / downloaded.
-
senderPeerId
{JSON}PeerId of the sender.
-
data
{JSON}The blob data. See the createObjectURL method on how you can convert the blob to a download link.
-
name
{JSON}Data name.
-
size
{JSON}Data size.
-
-
error
{JSON}The error object.
-
message
{String}Error message thrown.
-
transferType
{String}Is error from uploading or downloading. [Rel: Skylink.DATA_TRANSFER_TYPE]
-
handshakeProgress
Event fired when a peer's handshake progress has changed.
Event Payload:
-
step
{String}The handshake progress step. [Rel: Skylink.HANDSHAKE_PROGRESS]
-
peerId
{String}PeerId of the peer's handshake progress.
-
error
{Object | String}Error 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:
-
message
{JSON}Message object that is received.
-
content
{JSON | String}Data that is broadcasted.
-
senderPeerId
{String}PeerId of the sender peer.
-
targetPeerId
{String}PeerId that is specifically targeted to receive the message.
-
isPrivate
{Boolean}Is data received a private message.
-
isDataChannel
{Boolean}Is data received from a data channel.
-
-
peerId
{String}PeerId of the sender peer.
-
peerInfo
{JSON}Peer's information.
-
settings
{JSON}Peer's stream settings.
-
audio
{Boolean | JSON} OptionalPeer's audio stream settings. -
audio.stereo
{Boolean} OptionalIf peer has stereo enabled or not. -
video
{Boolean | JSON} OptionalPeer's video stream settings. -
video.resolution
{JSON} OptionalPeer's video stream resolution [Rel: Skylink.VIDEO_RESOLUTION] -
video.resolution.width
{Integer} OptionalPeer's video stream resolution width. -
video.resolution.height
{Integer} OptionalPeer's video stream resolution height. -
video.frameRate
{Integer} OptionalPeer's video stream resolution minimum frame rate.
-
-
mediaStatus
{JSON}Peer stream status.
-
audioMuted
{Boolean} OptionalIf peer's audio stream is muted. -
videoMuted
{Boolean} OptionalIf peer's video stream is muted.
-
-
userData
{JSON | String}Peer's custom user data.
-
agent
{JSON}Peer's browser agent.
-
name
{String}Peer's browser agent name. -
version
{Integer}Peer's browser agent version.
-
-
-
isSelf
{Boolean}Is 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.
- There has been a documentation error whereby the stream it is supposed to be (stream, peerId, isSelf), but instead is received as (peerId, stream, isSelf) in 0.5.0.
Event Payload:
-
peerId
{String}PeerId of the peer that is sending the stream.
-
stream
{Object}MediaStream object.
-
isSelf
{Boolean}Is the peer self.
-
peerInfo
{JSON}Peer's information.
mediaAccessError
Event fired when webcam or microphone media access fails.
Event Payload:
-
error
{Object | String}Error object thrown.
mediaAccessRequired
Event fired when it's required to have audio or video access.
mediaAccessStopped
Event fired when media access to MediaStream has stopped.
mediaAccessSuccess
Event fired when webcam or microphone media acces passes.
Event Payload:
-
stream
{Object}MediaStream object.
peerConnectionState
Event fired when a peer Connection state has changed.
Event Payload:
-
state
{String}The peer connection state. [Rel: Skylink.PEER_CONNECTION_STATE]
-
peerId
{String}PeerId of the peer that had a peer connection state change.
peerJoined
Event fired when a peer joins the room.
Event Payload:
-
peerId
{String}PeerId of the peer that joined the room.
-
peerInfo
{JSON}Peer's information.
-
settings
{JSON}Peer's stream settings.
-
audio
{Boolean | JSON} OptionalPeer's audio stream settings. -
audio.stereo
{Boolean} OptionalIf peer has stereo enabled or not. -
video
{Boolean | JSON} OptionalPeer's video stream settings. -
video.resolution
{JSON} OptionalPeer's video stream resolution [Rel: Skylink.VIDEO_RESOLUTION] -
video.resolution.width
{Integer} OptionalPeer's video stream resolution width. -
video.resolution.height
{Integer} OptionalPeer's video stream resolution height. -
video.frameRate
{Integer} OptionalPeer's video stream resolution minimum frame rate.
-
-
mediaStatus
{JSON}Peer stream status.
-
audioMuted
{Boolean} OptionalIf peer's audio stream is muted. -
videoMuted
{Boolean} OptionalIf peer's video stream is muted.
-
-
userData
{JSON | String}Peer's custom user data.
-
agent
{JSON}Peer's browser agent.
-
name
{String}Peer's browser agent name. -
version
{Integer}Peer's browser agent version.
-
-
-
isSelf
{Boolean}Is the peer self.
peerLeft
Event fired when a peer leaves the room
Event Payload:
-
peerId
{String}PeerId of the peer that left.
-
peerInfo
{JSON}Peer's information.
-
settings
{JSON}Peer's stream settings.
-
audio
{Boolean | JSON} OptionalPeer's audio stream settings. -
audio.stereo
{Boolean} OptionalIf peer has stereo enabled or not. -
video
{Boolean | JSON} OptionalPeer's video stream settings. -
video.resolution
{JSON} OptionalPeer's video stream resolution [Rel: Skylink.VIDEO_RESOLUTION] -
video.resolution.width
{Integer} OptionalPeer's video stream resolution width. -
video.resolution.height
{Integer} OptionalPeer's video stream resolution height. -
video.frameRate
{Integer} OptionalPeer's video stream resolution minimum frame rate.
-
-
mediaStatus
{JSON}Peer stream status.
-
audioMuted
{Boolean} OptionalIf peer's audio stream is muted. -
videoMuted
{Boolean} OptionalIf peer's video stream is muted.
-
-
userData
{JSON | String}Peer's custom user data.
-
agent
{JSON}Peer's browser agent.
-
name
{String}Peer's browser agent name. -
version
{Integer}Peer's browser agent version.
-
-
-
isSelf
{Boolean}Is the peer self.
peerRestart
Event fired when a peer's connection is restarted.
Event Payload:
-
peerId
{String}PeerId of the peer that is being restarted.
-
peerInfo
{JSON}Peer's information.
-
settings
{JSON}Peer's stream settings.
-
audio
{Boolean | JSON}Peer's audio stream settings. -
audio.stereo
{Boolean}If peer has stereo enabled or not. -
video
{Boolean | JSON}Peer's video stream settings. -
video.resolution
{JSON}Peer's video stream resolution [Rel: Skylink.VIDEO_RESOLUTION] -
video.resolution.width
{Integer}Peer's video stream resolution width. -
video.resolution.height
{Integer}Peer's video stream resolution height. -
video.frameRate
{Integer}Peer's video stream resolution minimum frame rate.
-
-
mediaStatus
{JSON}Peer stream status.
-
audioMuted
{Boolean}If peer's audio stream is muted. -
videoMuted
{Boolean}If peer's video stream is muted.
-
-
userData
{JSON | String}Peer's custom user data.
-
agent
{JSON}Peer's browser agent.
-
name
{String}Peer's browser agent name. -
version
{Integer}Peer's browser agent version.
-
-
-
isSelfInitiateRestart
{Boolean}Is it us who initiated the restart.
peerUpdated
Event fired when a peer information is updated.
Event Payload:
-
peerId
{String}PeerId of the peer that had information updaed.
-
peerInfo
{JSON}Peer's information.
-
settings
{JSON}Peer's stream settings.
-
audio
{Boolean | JSON} OptionalPeer's audio stream settings. -
audio.stereo
{Boolean} OptionalIf peer has stereo enabled or not. -
video
{Boolean | JSON} OptionalPeer's video stream settings. -
video.resolution
{JSON} OptionalPeer's video stream resolution [Rel: Skylink.VIDEO_RESOLUTION] -
video.resolution.width
{Integer} OptionalPeer's video stream resolution width. -
video.resolution.height
{Integer} OptionalPeer's video stream resolution height. -
video.frameRate
{Integer} OptionalPeer's video stream resolution minimum frame rate.
-
-
mediaStatus
{JSON}Peer stream status.
-
audioMuted
{Boolean} OptionalIf peer's audio stream is muted. -
videoMuted
{Boolean} OptionalIf peer's video stream is muted.
-
-
userData
{JSON | String}Peer's custom user data.
-
agent
{JSON}Peer's browser agent.
-
name
{String}Peer's browser agent name. -
version
{Integer}Peer's browser agent version.
-
-
-
isSelf
{Boolean}Is the peer self.
readyStateChange
Event fired whether the room is ready for use.
Event Payload:
-
readyState
{String}[Rel: Skylink.READY_STATE_CHANGE]
-
error
{JSON}Error object thrown.
-
status
{Integer}Http status when retrieving information. May be empty for other errors.
-
content
{String}Error message.
-
errorCode
{Integer}Error code. [Rel: Skylink.READY_STATE_CHANGE_ERROR]
-
roomLock
Event fired when connected to a room and the lock status has changed.
Event Payload:
-
isLocked
{Boolean}Is the room locked.
-
peerId
{String}PeerId of the peer that is locking/unlocking the room.
-
peerInfo
{JSON}Peer's information.
-
settings
{JSON}Peer's stream settings.
-
audio
{Boolean | JSON} OptionalPeer's audio stream settings. -
audio.stereo
{Boolean} OptionalIf peer has stereo enabled or not. -
video
{Boolean | JSON} OptionalPeer's video stream settings. -
video.resolution
{JSON} OptionalPeer's video stream resolution [Rel: Skylink.VIDEO_RESOLUTION] -
video.resolution.width
{Integer} OptionalPeer's video stream resolution width. -
video.resolution.height
{Integer} OptionalPeer's video stream resolution height. -
video.frameRate
{Integer} OptionalPeer's video stream resolution minimum frame rate.
-
-
mediaStatus
{JSON}Peer stream status.
-
audioMuted
{Boolean} OptionalIf peer's audio stream is muted. -
videoMuted
{Boolean} OptionalIf peer's video stream is muted.
-
-
userData
{JSON | String}Peer's custom user data.
-
agent
{JSON}Peer's browser agent.
-
name
{String}Peer's browser agent name. -
version
{Integer}Peer's browser agent version.
-
-
-
isSelf
{Boolean}Is the peer self.
socketError
Event fired when the socket connection failed connecting.
- The difference between this and channelError is that channelError triggers during the connection. This throws when connection failed to be established.
Event Payload:
-
errorCode
{String}The error code. [Rel: Skylink.SOCKET_ERROR]
-
error
{Integer | String | Object}The reconnection attempt or error object.
-
fallbackType
{String}The type of fallback [Rel: Skylink.SOCKET_FALLBACK]
systemAction
Event fired when the signaling server warns the user.
Event Payload:
-
action
{String}The action that is required for the user to follow. [Rel: Skylink.SYSTEM_ACTION]
-
message
{String}The reason for the action.
-
reason
{String}The reason why the action is given. [Rel: Skylink.SYSTEM_ACTION_REASON]