ActivityWatcher
@3dverse/livelink / ActivityWatcher
Class: ActivityWatcher
Defined in: node_modules/@3dverse/livelink.core/dist/sources/ActivityWatcher.d.ts:25
Watch activity on the gateway.
Activity is defined as any message sent to the gateway that is not a heartbeat.
Internally the activity watcher uses two timeouts:
- Inactivity warning: the time in seconds after which the
on-warning
event is dispatched. - Inactivity timeout: the time in seconds after which the
on-timeout
event is dispatched.
The on-timeout
event automatically triggers the disconnection from the gateway.
The application should listen to these events and act accordingly.
Usually, when the on-warning
event is dispatched, the application should display a warning to the user.
It is up to the application to decide what can be qualified as activity.
For example, the application could consider the user moving the mouse as activity. In this case, the application
would listen to the "mousemove" event and reset the activity watcher whenever the mouse is moved calling
the ActivityWatcher.reset
method.
When the on-timeout
event is dispatched, there is no way to recover the connection. The application should
display an error message to the user.
Constructors
new ActivityWatcher()
new ActivityWatcher():
ActivityWatcher
Returns
Properties
reset()
reset: () =>
void
Defined in: node_modules/@3dverse/livelink.core/dist/sources/ActivityWatcher.d.ts:62
Reset the timeouts.
Returns
void
Accessors
inactivity_warning
Get Signature
get inactivity_warning():
number
Defined in: node_modules/@3dverse/livelink.core/dist/sources/ActivityWatcher.d.ts:31
Inactivity warning in seconds.
Amount of time in seconds after which the on-inactivity-warning
event is dispatched.
Returns
number
inactivity_timeout
Get Signature
get inactivity_timeout():
number
Defined in: node_modules/@3dverse/livelink.core/dist/sources/ActivityWatcher.d.ts:36
Inactivity timeout in seconds.
Amount of time in seconds after which the on-timeout
event is dispatched.
Returns
number
is_running
Get Signature
get is_running():
boolean
Defined in: node_modules/@3dverse/livelink.core/dist/sources/ActivityWatcher.d.ts:40
True if the timeouts have been started.
Returns
boolean
has_timed_out
Get Signature
get has_timed_out():
boolean
Defined in: node_modules/@3dverse/livelink.core/dist/sources/ActivityWatcher.d.ts:44
True if activity watcher has timed out
Returns
boolean
Methods
setTimeouts()
setTimeouts(
params
):void
Defined in: node_modules/@3dverse/livelink.core/dist/sources/ActivityWatcher.d.ts:55
Set the timeouts.
Setting these values will reset the activity watcher if it is running.
Parameters
params
warn_after_seconds
number
Amount of time in seconds after which the on-warning
event is dispatched.
Must be less than timeout_after_seconds
.
timeout_after_seconds
number
Amount of time in seconds after which the on-timeout
event is dispatched.
Returns
void