LocalPresence

  1. Methods
    1. submit()
    2. send()
    3. destroy()

LocalPresence represents the presence of the local client. For example, this might be the position of a caret in a text document; which field has been highlighted in a complex JSON object; etc.

Local presence is created from a parent Presence instance using presence.create().

Methods

submit()

Update the local representation of presence, and broadcast that presence to any other presence subscribers.

localPresence.submit(presence [, callback])

presence – Object

The presence object to broadcast. The structure of presence will depend on the type

A value of null will be interpreted as the client no longer being present

callback – Function

Optional

function(error) { ... }

A callback that will be called once the presence has been sent

send()

Send the current value of presence to other subscribers, without updating it. This is like submit() but without changing the value.

This can be useful if local presence is set to periodically expire (e.g. after a period of inactivity).

localPresence.send([callback])

callback – Function

Optional

function(error) { ... }

A callback that will be called once the presence has been sent

destroy()

Inform all remote clients that this presence is now null, and deletes itself for garbage collection.

localPresence.destroy([callback])

callback – Function

Optional

function(error) { ... }

A callback that will be called once the presence has been destroyed