Compartilhar via


@microsoft/live-share package

Classes

AzureLiveShareHost

This host enables using Live Share through your own AzureClient implementation. This is not intended to be used with LiveShareClient. We provide no SLA guarantees on this implementation while it is in alpha.

DynamicObjectRegistry

Static registry class for loadable projects for use in frameworks like @microsoft/live-share-turbo. All Live Share packages and extension frameworks (e.g., LiveMediaSession in our media package) will register their classes from within their main files. Goal of this class is for all Live Share packages that a developer has installed will be registered as available dynamic objects without the core package needing to be aware of what every DDS is.

HostTimestampProvider

Timestamp Provider that calls the Live Share Host to lookup the current time.

LiveDataObject

Extends Fluid's DataObject class. Intended for use with Live Share custom DDS's that rely on a ILiveShareHost.

LiveEvent

Live fluid object that broadcasts an event to other clients and a set of static event related helpers.

remarks

Applications should call on('received', (evt, local) => {}) to listen for local events sent and remote events received. Events aren't guaranteed to be delivered so you should limit their use to sending events you're ok with potentially being missed. Reactions are a good use case for LiveEvents. Use something like the LiveState class when syncing state.

LiveEventScope

Object responsible for sending and receiving live share events.

LiveEventSource

Broadcasts live share events to all clients and can be received by an LiveEventTarget.

LiveEventTarget

Receives events broadcast by an LiveEventSource.

LiveEventTimer

Periodically broadcasts an event to listening LiveEventTarget instances.

LiveFollowMode

Live object that allows users to present and/or follow other users. Provides a state value, which reflects the relevant value to reference (e.g., the presenting user's state value).

LivePresence

Live fluid object that synchronizes presence information for the user with other clients.

LivePresenceUser

A user that presence is being tracked for.

LiveShareClient

Client used to connect to fluid containers within a Microsoft Teams context.

LiveShareRuntime

Runtime for LiveDataObject, which is used to do things like validate roles, get a timestamp

LiveState

Live fluid object that synchronizes a named state and optional data value across clients.

LiveTelemetryLogger

Wraps the configured logger for the runtime and ensures that certain mandatory properties are included on outgoing telemetry events.

LiveTimer

Extends Fluid's DataObject class. Intended for use with Live Share custom DDS's that rely on a ILiveShareHost.

LocalTimestampProvider

Implements a local timestamp provider for testing purposes.

TestLiveShareHost

Live Share Host implementation used for local testing.

TimestampProvider

Default ITimestampProvider implementation.

Interfaces

IClientInfo

Returned from LiveShareHost.getClientInfo() to specify the user information for a given clientId. Each user individually requests this data for each other user in the session, making it secure & trusted.

IClientTimestamp

Base interface for all client timestamp comparisons.

IContainerRuntimeSignaler

Duck type of something that provides the expected signalling functionality at the container level.

IEvent

Base interface for all event objects.

IFluidContainerInfo

Returned from LiveShareHost.get/setFluidContainerId() to specify the container mapping for the current Live Share session.

IFluidTenantInfo

Returned from LiveShareHost.getFluidTenantInfo() to specify the Fluid service to use for the current Live Share session.

IFollowModePresenceUserData

The presence data for a user's personal follow mode state.

IFollowModeState

Information about the state of the local user's follow mode.

ILiveEvent

Base type for all incoming live share events of a certain type

ILiveEventEvents
ILiveFollowModeEvents
ILivePresenceEvents
ILiveShareClientOptions

Options used to configure the LiveShareClient class.

ILiveShareHost

Interface for hosting a Live Share session within a client like Teams.

ILiveShareJoinResults

Response object from .joinContainer() in LiveShareClient

ILiveStateEvents
ILiveTelemetryProperties

Properties included on all events sent by LiveTelemetryLogger.

ILiveTimerEvents
INtpTimeInfo

Returned from LiveShareHost.getNtpTime() to specify the global timestamp for the current Live Share session.

IRuntimeSignaler

Duck type of something that provides the expected signalling functionality: A way to verify we can signal, a way to send a signal, and a way to listen for incoming signals

ITimerConfig
ITimerConfigData

Type Aliases

FollowModePresenceUser

Convenience type for a LivePresenceUser in LiveFollowMode

GetLocalUserCanSend

Callback function used to validate whether or not the local user can send an update for this object.

LiveEventListener

Live event callback.

UpdateSynchronizationState

Callback function used to the receive the state update sent by a remote live object.

Enums

ContainerState

State of the current Live Share sessions backing fluid container.

FollowModeType

The follow mode type.

LiveDataObjectInitializeState

The initialization state for the LiveDataObject class.

LiveEventEvents

Events supported by LiveEvent object.

LiveFollowModeEvents

Events supported by LiveFollowMode object.

LivePresenceEvents

Events supported by LivePresence object.

LiveStateEvents

Events supported by [LiveState` object.

LiveTimerEvents

Events supported by LiveTimer object.

PresenceState

List of possible presence states.

UserMeetingRole

Allowed roles during a meeting.

Functions

getLiveContainerSchema(ContainerSchema, LiveShareRuntime)

Inject Live Share dependencies into your Fluid container schema. This should only be done once, right before connecting to a container.

getLiveContainerSchemaProxy(ContainerSchema, LiveShareRuntime)
getLiveDataObjectClass<TClass>(LoadableObjectClass<any>, LiveShareRuntime, Map<string, LoadableObjectClass<any>>)

Inject Live Share dependencies to relevant LiveDataObject derived classes. Regular DataObject classes are not injected.

Function Details

getLiveContainerSchema(ContainerSchema, LiveShareRuntime)

Inject Live Share dependencies into your Fluid container schema. This should only be done once, right before connecting to a container.

function getLiveContainerSchema(schema: ContainerSchema, liveRuntime: LiveShareRuntime): ContainerSchema

Parameters

schema

ContainerSchema

Fluid ContainerSchema you would like to inject the runtime into

liveRuntime
LiveShareRuntime

LiveShareRuntime instance

Returns

ContainerSchema

ContainerSchema with injected dependencies

Remarks

Needed because Fluid uses static factories to construct data objects internally, and LiveDataObject instances require access to the LiveShareRuntime before use. Users should not use this method if you are connecting to a container using LiveShareClient. This is intended to be used when you are using another Fluid client, such as AzureClient.

getLiveContainerSchemaProxy(ContainerSchema, LiveShareRuntime)

Warning

This API is now deprecated.

Use getLiveContainerSchema instead.

function getLiveContainerSchemaProxy(schema: ContainerSchema, liveRuntime: LiveShareRuntime): ContainerSchema

Parameters

schema

ContainerSchema

liveRuntime
LiveShareRuntime

Returns

ContainerSchema

getLiveDataObjectClass<TClass>(LoadableObjectClass<any>, LiveShareRuntime, Map<string, LoadableObjectClass<any>>)

Inject Live Share dependencies to relevant LiveDataObject derived classes. Regular DataObject classes are not injected.

function getLiveDataObjectClass<TClass>(ObjectClass: LoadableObjectClass<any>, liveRuntime: LiveShareRuntime, injectedClasses?: Map<string, LoadableObjectClass<any>>): LoadableObjectClass<TClass>

Parameters

ObjectClass

LoadableObjectClass<any>

a LoadableObjectClass instance to inject with the liveRuntime provided, if needed.

liveRuntime
LiveShareRuntime

the LiveShareRuntime instance to inject into provided LiveDataObject instances.

injectedClasses

Map<string, LoadableObjectClass<any>>

Optional. Map of classes that have already been injected. Default value is an empty map.

Returns

LoadableObjectClass<TClass>

the new LoadableObjectClass if injected, or the same ObjectClass passed in if not.

Remarks

Can be used to follow the pattern of this package's unit tests for custom LiveDataObject implementations.