Apr 24, 2024 10:48 Parameters Returns Supported Clients Sample Returns Supported Clients Sample Returns Supported Clients Sample Parameters Returns Supported Clients Sample Parameters Returns Supported Clients Sample Returns Supported Clients Sample Returns Supported Clients Sample Parameters Supported Clients Sample Parameters Supported Clients Sample Parameters Supported Clients Sample Supported Clients Sample Parameters Supported Clients Sample Parameters Supported Clients SampleSupported Clients
SmartClient
WebClient
NGClient
Methods Summary
Broadcaster
getBroadcaster(name, channelName, callback)
Get a broadcast object giving it a (nick)name and on a specific channel, the callback is used for getting messages of other clients on that channel
The function gets 3 arguments (nickName, message, channelName)
JSClientInformation
getClientInformation()
Returns the current client JSClientInformation object.
Array
getConnectedClients()
Returns an array of JSClientInformation elements describing the clients connected to the server.
Array
getConnectedClients(clientInfoFilter)
/*
Returns an array of JSClientInformation elements describing the clients connected to the server filtered by the a client info string.
JSClientInformation
getLockedByClient(datasource, pks)
Get client that locked the record from a specific datasource or null if record is not locked.
JSDataSet
getLocks()
Get a dataset will all locks on the server.
Boolean
isInMaintenanceMode()
Returns true if the server is in maintenance mode, false otherwise.
void
releaseLocks(clientId)
Release all locks acquired by a client
WARNING: use with care
void
sendMessageToAllClients(message)
Sends a message to all connected clients.
void
sendMessageToClient(clientId, message)
Sends a message to a specific client, identified by its clientId.
void
shutDownAllClients()
Shuts down all connected clients.
void
shutDownClient(clientId)
Shuts down a specific client, identified by its clientId.
void
shutDownClient(clientId, forceUnregister)
Shuts down a specific client, identified by its clientId.
Methods Details
getBroadcaster(name, channelName, callback)
Get a broadcast object giving it a (nick)name and on a specific channel, the callback is used for getting messages of other clients on that channel
The function gets 3 arguments (nickName, message, channelName)
String
name
The nickname for this user on this channel
String
channelName
The channel name where should be listened to (and send messages to)
Function
callback
The callback when for incomming messages
function callback(nickName, message, channelName) {
application.output('message received from ' + nickName + ' on channel ' + channelName + ': ' + message)
}
var broadcaster = plugins.clientmanager.getBroadcaster("nickname", "mychatchannel", callback);
broadcaster.broadcastMessage("Hallo");
getClientInformation()
Returns the current client JSClientInformation object. Note this is snapshot information, client information will not get updated.
getConnectedClients()
Returns an array of JSClientInformation elements describing the clients connected to the server. Note this is snapshot information on connected clients, client information will not get updated.
//Returns an array of JSClientInformation elements describing the clients connected to the server.
var clients = plugins.clientmanager.getConnectedClients();
application.output("There are " + clients.length + " connected clients.");
for (var i = 0; i < clients.length; i++)
application.output("Client has clientId '" + clients[i].getClientID() + "' and has connected from host '" + clients[i].getHostAddress() + "'.");
getConnectedClients(clientInfoFilter)
/*
Returns an array of JSClientInformation elements describing the clients connected to the server filtered by the a client info string.
This way you can ask for a specific set of clients that have a specific information added to there client information.
Note this is snapshot information on connected clients, client information will not get updated.
String
clientInfoFilter
The filter string
//Returns an array of JSClientInformation elements describing the clients connected to the server.
var clients = plugins.clientmanager.getConnectedClients();
application.output("There are " + clients.length + " connected clients.");
for (var i = 0; i < clients.length; i++)
application.output("Client has clientId '" + clients[i].getClientID() + "' and has connected from host '" + clients[i].getHostAddress() + "'.");
getLockedByClient(datasource, pks)
Get client that locked the record from a specific datasource or null if record is not locked.
String
datasource
;
Array
pks
;
var client = plugins.clientmanager.getLockedByClient(foundset.getDataSource(),record.getPKs());
getLocks()
Get a dataset will all locks on the server. The dataset will have four columns: datasource, acquireDate, clientId, pkHash.
Each row in the dataset will be a lock.
var locks = plugins.clientmanager.getLocks();
isInMaintenanceMode()
Returns true if the server is in maintenance mode, false otherwise.
//Returns true if the server is in maintenance mode, false otherwise.
if (plugins.maintenance.isInMaintenanceMode())
application.output("Server is in maintenance mode.");
else
application.output("Server is not in maintenance mode.");
releaseLocks(clientId)
Release all locks acquired by a client
WARNING: use with care
String
clientId
;
sendMessageToAllClients(message)
Sends a message to all connected clients.
String
message
;
//Sends a message to all connected clients.
plugins.clientmanager.sendMessageToAllClients("Hello, all clients!");
sendMessageToClient(clientId, message)
Sends a message to a specific client, identified by its clientId. The clientIds are retrieved by calling the getConnectedClients method.
String
clientId
;
String
message
;
//Sends a message to a specific client, identified by its clientId. The clientIds are retrieved by calling the getConnectedClients method.
var clients = plugins.clientmanager.getConnectedClients();
for (var i=0; i<clients.length; i++)
plugins.clientmanager.sendMessageToClient(clients[i].getClientId(), "Hello, client " + clients[i].getClientID() + "!");
shutDownAllClients()
Shuts down all connected clients. This method returns immediately, it does not wait until the client shuts down.
//Shuts down all connected clients. This method returns immediately, it does not wait until the client shuts down.
plugins.clientmanager.shutDownAllClients();
shutDownClient(clientId)
Shuts down a specific client, identified by its clientId. The clientIds are retrieved by calling the getConnectedClients method. This method returns immediately, it does not wait until the client shuts down.
String
clientId
;
//Shuts down a specific client, identified by its clientId. The clientIds are retrieved by calling the getConnectedClients method. This method returns immediately, it does not wait until the client shuts down.
var clients = plugins.clientmanager.getConnectedClients();
for (var i=0; i<clients.length; i++)
plugins.clientmanager.shutDownClient(clients[i].getClientId());
shutDownClient(clientId, forceUnregister)
Shuts down a specific client, identified by its clientId. The clientIds are retrieved by calling the getConnectedClients method. This method returns immediately, it does not wait until the client shuts down.
If forceUnregister is true, the client will unregister itself from server. Beware this should be used only if you are sure client is already closed (cannot connect anymore)
String
clientId
;
Boolean
forceUnregister
client is forced to unregister from server
//Shuts down a specific client, identified by its clientId. The clientIds are retrieved by calling the getConnectedClients method. This method returns immediately, it does not wait until the client shuts down.
var clients = plugins.clientmanager.getConnectedClients();
for (var i=0; i<clients.length; i++)
plugins.clientmanager.shutDownClient(clients[i].getClientId());