Type of event to broadcast.
The objects fluid type/name.
The objects fluid type factory.
Returns true if the object has been initialized.
initialize the object.
Optional. List of roles allowed to send events.
Broadcasts an event to all other clients.
The event will be queued for delivery if the client isn't currently connected.
Optional. Event to send. If omitted, an event will still be sent but it won't include any custom event data.
The full event object that was sent, including the timestamp of when the event
was sent and the clientId if known. The clientId will be undefined
if the client is
disconnected at time of delivery.
Returns the list of roles supported for a client.
Client ID to lookup.
The list of roles for the client.
Returns the current timestamp as the number of milliseconds sine the Unix Epoch.
Returns true if a received event is newer then the current event.
Used when building new Live objects to process state change events. The isNewer()
method implements an algorithm that deals with conflicting events that have the same timestamp
and older events that should have debounced the current event.
The algorithm employed by isNewer() helps ensure that all clients will eventually reach a consistent state with one other.
Current event to compare received event against.
Received event.
Optional. Time in milliseconds to ignore any new events for. Defaults to 0 ms.
True if the received event is newer then the current event and should replace the current one.
Registers client id of the current user.
Client ID to map to current user.
The list of roles for the client.
Verifies that a client has one of the specified roles.
Client ID to inspect.
User roles that are allowed.
True if the client has one of the specified roles.
Generated using TypeDoc
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 forLiveEvents
. Use something like theLiveState
class when syncing state.