Methods
Constructor#
class SyncStage implements ISyncStage{
constructor(
userDelegate: ISyncStageUserDelegate | null,
connectivityDelegate: ISyncStageConnectivityDelegate | null,
discoveryDelegate: ISyncStageDiscoveryDelegate | null,
desktopAgentDelegate: ISyncStageDesktopAgentDelegate | null,
onTokenExpired: (() => Promise<string>) | null,
);
}
Constructor parameters:
-
userDelegate
- delegate object to receive events about users in session state -
discoveryDelegate
- delegate object responsible for getting callbacks about available zones latency. -
connectivityDelegate
- delegate object to receive events with information about stream connection to Studio Server state -
desktopAgentDelegate
- delegate object to receive events with information of desktop agent acquisition and release to prevent users from using SyncStage in multiple browser tabs at once -
onTokenExpired
- callback to be called whenjwt
expires, callback should return new refetchedjwt
Initialize#
Initializes the SDK SyncStage object.
Parameters:
jwt
- token obtained in the provisioning process.
Update JWT#
You can update JWT anytime you want, even before expiration takes place.
jwt
- token obtained in the provisioning process.
Get is desktop agent connected#
Checks if desktop agent is running and available on the localhost.
Get SDK version#
Gets SDK version.
Update SDK to SyncStage backend connected callback#
Parameters:
onWebsocketReconnected
- method to be called when the browser SDK reconnects to the SyncStage services. Session state should be refetched and synchronized on the UI in this callback.
Get best available server#
Get best available server, where a session can be created
Get server instances#
Get server instances so you can select the server that is suitable for your session.
Create a session#
Creates a session in a given zone by a given user from your user pool.
async createSession(
zoneId: string,
studioServerId: string,
userId: string
): Promise<[ISessionIdentifier | null, SyncStageSDKErrorCode]>
Parameters:
zoneId
- zone in which your session is hostedstudioServerId
- studio server where you are running your sessionuserId
- id of your app user to match the data between SyncStage and your backend
Join the session#
Joins a particular session identified by sessionCode
.
async join(
sessionCode: string,
userId: string,
zoneId: string,
studioServerId: string,
displayName?: string | null,
): Promise<[ISession | null, SyncStageSDKErrorCode]>
Parameters:
-
sessionCode
- the session code -
userId
- id of your app user to match de data between SyncStage and your backend -
zoneId
- zone in which your session is hosted -
studioServerId
- studio server where you are running your session -
displayName
- your app user display name
Get session state#
Gets state of currently joined session.
Leave the session#
Leaves currently joined session.
Mute / unmute microphone#
Enables or disables microphone stream.
Parameters:
mute
- desired state of the mute option
Is muted#
Returns state of microphone stream.
Get receiver network measurements#
Returns Measurements object with network delay, jitter, and calculated network quality indicators.
async getReceiverMeasurements(identifier: string): Promise<[IMeasurements | null, SyncStageSDKErrorCode]>
Parameters:
identifier
- receiver's identifier
Get transmitter network measurements#
Returns Measurements object with network delay, jitter, and calculated network quality indicators.
Start recording#
Stop recording#
Register Desktop Agent Reconnected Callback#
In case of reconnection UI application should be aware of this fact, to refetch the session state to keep it synchronized.
Parameters:
onWebsocketReconnected
- callback
Unregister Desktop Agent Reconnected Callback#
Remove the callback in the SyncStage.