TestLiveShareHost class

Live Share Host implementation used for local testing.

Properties

defaultLocalRoles
defaultRemoteRoles
LOCAL_MODE_TEST_TOKEN

Methods

addClient(string, UserMeetingRole[])
create(() => undefined | string, (containerId: string) => void)

Creates an new live share host for local testing.

getClientInfo(string)

Queries the hosts IClientInfo for a given client ID.

getClientRoles(string)
getFluidContainerId()

Returns the container mapping information for the current session.

getFluidTenantInfo()

Returns the Fluid service endpoint and tenant to use for the current session.

getFluidToken(string)

Returns the Fluid access token to use for the current session.

getNtpTime()

Returns the global timestamp for the current session.

registerClientId(string)

Registers the local clients Fluid client ID with the hosts role verification service.

setFluidContainerId(string)

Attempts to save the ID of the Fluid container created to the hosts mapping service.

Property Details

defaultLocalRoles

defaultLocalRoles: UserMeetingRole[]

Property Value

defaultRemoteRoles

defaultRemoteRoles: UserMeetingRole[]

Property Value

LOCAL_MODE_TEST_TOKEN

static LOCAL_MODE_TEST_TOKEN: "test-token" = "test-token"

Property Value

"test-token"

Method Details

addClient(string, UserMeetingRole[])

function addClient(clientId: string, roles: UserMeetingRole[]): TestLiveShareHost

Parameters

clientId

string

roles

UserMeetingRole[]

Returns

create(() => undefined | string, (containerId: string) => void)

Creates an new live share host for local testing.

static function create(getLocalTestContainerId?: () => undefined | string, setLocalTestContainerId?: (containerId: string) => void): ILiveShareHost

Parameters

getLocalTestContainerId

() => undefined | string

Optional. Function to customize reading the test container ID. The default implementation reads the ID from the browsers # URL.

setLocalTestContainerId

(containerId: string) => void

Optional. Function to customize saving the test container ID. The default implementation appends the ID to the browsers # URL.

Returns

getClientInfo(string)

Queries the hosts IClientInfo for a given client ID.

function getClientInfo(clientId: string): Promise<IClientInfo>

Parameters

clientId

string

ID of the client to lookup.

Returns

Promise<IClientInfo>

IUserInfo for the queried client ID, or undefined if the client hasn't yet been registered

getClientRoles(string)

Warning

This API is now deprecated.

Queries the hosts role verification service for the roles associated with a given client ID.

function getClientRoles(clientId: string): Promise<UserMeetingRole[]>

Parameters

clientId

string

ID of teh client to lookup.

Returns

Promise<UserMeetingRole[]>

An array of roles assigned to the queried client ID.

getFluidContainerId()

Returns the container mapping information for the current session.

function getFluidContainerId(): Promise<IFluidContainerInfo>

Returns

Remarks

Hosts are required to implement a container mapping service that stores the container ID for the current session.

TODO: add creation protocol details

getFluidTenantInfo()

Returns the Fluid service endpoint and tenant to use for the current session.

function getFluidTenantInfo(): Promise<IFluidTenantInfo>

Returns

Promise<IFluidTenantInfo>

getFluidToken(string)

Returns the Fluid access token to use for the current session.

function getFluidToken(containerId?: string): Promise<string>

Parameters

containerId

string

Optional. ID of the container being joined. This will be undefined when creating a new container.

Returns

Promise<string>

getNtpTime()

Returns the global timestamp for the current session.

function getNtpTime(): Promise<INtpTimeInfo>

Returns

Promise<INtpTimeInfo>

registerClientId(string)

Registers the local clients Fluid client ID with the hosts role verification service.

function registerClientId(clientId: string): Promise<UserMeetingRole[]>

Parameters

clientId

string

Unique ID assigned to the local Fluid client.

Returns

Promise<UserMeetingRole[]>

An array of meeting roles assigned to the local user.

Remarks

Hosts should expect this to be called anytime the Fluid clients underlying socket connects or reconnects.

setFluidContainerId(string)

Attempts to save the ID of the Fluid container created to the hosts mapping service.

function setFluidContainerId(containerId: string): Promise<IFluidContainerInfo>

Parameters

containerId

string

Id of the Fluid container that was created.

Returns

Information indicating the success of mapping assignment.

Remarks

Hosts should return a containerState of "Added" if the mapping was successfully saved, otherwise a state of "Conflict" should be returned to indicate that another client has already saved a container ID for the current session.