Constructor
new ClientActivityMonitor(server, dataUpdateManageropt)
Creates a new activity monitor for the given server.
Parameters:
Example
const monitor = new ClientActivityMonitor(server);
monitor.start();
Members
callback :function|null
A callback method which is invoked before an inactive/disconnected client is removed from the
active client list. The remove action can be cancelled by returning false from the callback method.
Type:
disconnectedWebSocketTimeout :number
The amount of time in seconds (2min default) before a WebSocket connected client is considered
to be inactive when the connection is in a closed state. If the WebSocket connection is opened
again within this time-frame the Client is not considered inactive.
Type:
inactiveClientXhrTimeout :number
The amount of time in seconds before an XHR connected client is considered to be inactive.
Type:
isRunning :boolean
Gets a value indicating if the client activity monitor is running.
Type:
removeInactiveClientsInterval :number
The interval in seconds (1min default) between each check where inactive clients are removed
from the connected clients list.
Type:
Methods
removeInactiveClientsNow()
Test hook that triggers the inactive client check immediately, since #removeInactiveClients is
a true private method and can't be reached from outside the class any other way.
start(optionsopt)
Starts the client activity monitor as a running background process which removes inactive clients.
Parameters:
| Name |
Type |
Attributes |
Description |
options |
object
|
<optional>
|
Properties
| Name |
Type |
Attributes |
Description |
removeInactiveClientsInterval |
number
|
<optional>
|
|
inactiveClientXhrTimeout |
number
|
<optional>
|
|
disconnectedWebSocketTimeout |
number
|
<optional>
|
|
callback |
function
|
null
|
<optional>
|
|
|
stop()
Stops the client activity monitor.