Server¶
Class: jstp.Server¶
JSTP server base class with necessary methods. All of the transport servers extend this class.
Event: 'connect'¶
Emitted when a JSTP connection is established and new session is created.
Event: 'reconnect'¶
Emitted when a JSTP connection is established that is reusing existing session.
Event: 'disconnect'¶
Emitted when a JSTP connection is closed.
server.getClients()¶
- Returns:
<Iterator>
Get all clients as an Iterator of Connection
instances.
server.getClientsArray()¶
- Returns:
<Connection[]>
server.updateApplications(applications)¶
applications
<Application[]>
|Map
New applications array or index obtained fromjstp.createAppsIndex()
.
Replaces set of applications/applications versions available when connecting to the server.
server.updateConnectionsApi()¶
This function updates application version for each connection.
It will update connection's application to the newest version in the range
requested by the client. For example, if the client requested '1.1.x'
range
and was using version '1.1.1', it will be updated to the latest SemVer
compatible version in this range (e.g. '1.1.2'
, but not '1.2.x'
).
If no suitable version is found, the client will use its previous app version.
server.broadcast(interfaceName, eventName, ...args)¶
Send event to all of the clients connected to the server.