Disconnects any clients with the specified address (typically an IP address) and prevents any future client connections from that address. By default, ban() requires administrator privileges. To allow other types of clients (such as moderators) to ban addresses, define a remote-client security rule.
The result of the ban attempt is returned via a ClientManagerEvent.BAN_RESULT event.
The address to ban (typically an IP address).
The duration of the ban, in seconds.
An arbitrary, optional string indicating the reason for the ban. The reason string is saved in the server-side ban list.
Returns a Boolean indicating whether the client with the specified clientID is known to the current client. The client is "known" in the following situations:
Permanently disables this object. The object cannot be reused. The dispose() method's purpose is to put this object into a state in which it can be garbage collected.
Returns an array of objects containing values for the specified attribute for all clients
in supplied clientIDs. Each object in the returned array has a clientID
property
(giving the client id), and a value
property (giving the attribute value).
The value property will be null
for clients in clientIDs that either do not exist or do
not have a value set for the specified attribute.
For information on client attributes see the Client.setAttribute method.
An array of client ids indicating the clients for which to retrieve the specified attribute.
The name of the attribute to retrieve.
The scope of the attribute to retrieve. Omit for global attributes.
Returns an object representing the specified client; by default, the object is an instance of the Client class. However, if a custom class has been specified for the client in the specified scope, the object will be an instance of that custom class.
The server-generated client ID for the client.
An optional fully qualified room id (e.g., "examples.chatRoom").
Returns the first client known to the ClientManager that has an attribute name and value matching the specified attribute name and value. If no client has a matching attribute, returns null.
The name of the attribute to match.
The value of the attribute to match.
The scope of the attribute to match. Use undefined for global.
A fully qualified room id (e.g., "examples.chatRoom"). For details, see the "scope" parameter of the getClient method.
Returns the client that is logged into the account specified by userID. If no known client is logged in under the specified userID, returns null.
A user account's userID.
A fully qualified room id (e.g., "examples.chatRoom"). For details, see the "scope" parameter of the ClientManager.getClient method.
Returns a list of all client objects known to the current client. Each client object in the list is an instance of either Client or a custom client class.
Returns the class used as the global default class for clients in this application.
Returns the internal Client object for the specified client id. This method is required in one situation only: when an application specifies a custom client class that does not extend CustomClient, it must implement IClient directly, and compose a Client instance. To obtain the composed instance, the custom class must use getInternalClient(). Otherwise, client applications should retrieve Client objects via getClient, not getInternalClient.
The server-generated client ID.
Returns a hash of Client objects known to the current client, where the hash keys are client IDs, and the hash values are Client objects. Contrast with getClients, whose client objects are instances custom client classes for any client that specifies a custom client class. Because getInternalClients() performs no custom-client-class lookup, is faster than getClients().
Returns the total number of clients that have ever been known to the current client, excluding itself.
Returns the number of clients known to Orbiter. When the ClientManager is watching for clients (see watchForClients), getNumClients() returns the actual number of clients currently connected to Union Server. When the ClientManager is not watching for clients, getNumClients() returns only the number of clients about which the current client is aware. For example, if the current client is in a room with three other clients, and has no other awareness of clients on the server, then getNumClients() will return 4, even though more than 4 clients might be connected to the server.
If the ClientManager is watching for clients, getNumClientsOnServer() returns the number of clients on the server; otherwise, getNumClientsOnServer() returns 0. When the ClientManager is watching for clients, the getNumClientsOnServer() method provides a faster alternative to getNumClients().
Returns true if the client with the specified clientID is in the watched client list; false otherwise.
Returns true if the client with the specified clientID is currently being observed; false otherwise.
Indicates whether the current client is currently watching for clients.
Disconnects the specified client from the server. By default, requires moderator privileges.
The result of the kick attempt is returned via a ClientManagerEvent.KICK_RESULT event.
The clientID of the client to kick.
Asks the server to register the current client as an observer of the client specified by clientID. The result of the request is returned via a ClientEvent.OBSERVE_RESULT event triggered by the ClientManager. If the request succeeds, Orbiter creates a Client object for the client (if one does not already exist), and a ClientEvent.OBSERVE event is triggered by the ClientManager. The Client object is then synchronized with the server-side state of the client. Subsequently if the specified client's state changes, the current client is notified in the following ways:
To stop observing a client, use Client.stopObserving method.
Client observation is used when a client wishes to stay informed of the state of an arbitrary list of clients, as is typical in applications with client match-making or administrative interfaces.
The clientID of the client to observe.
Sends a message to a set of specified clientIDs
. To send a message to a single client
only, use Client.sendMessage method. To receive the message, recipient clients must
register a message listener via MessageManager.addMessageListener method.
The name of the message to send.
An array of the recipient client ID(s) for the message.
Specifies one or more filters for the message. A filter specifies a requirement that each client must meet in order to receive the message. For example, a filter might indicate that only those clients with the attribute "team" set to "red" should receive the message. If filters is null, all specified clients receive the message.
An optional comma-separated list of string arguments for the message. These will be passed to any listeners registered to receive the message. See MessageManager.addMessageListener method.
Assigns a class to use as the default class for all clients in the application.
By default, all clients are represented by instances of the Client class. An application can, however, choose to represent clients with a custom class. The custom client class can be specified on a per-client basis via the Client.setClientClass method. Or, the custom class can be specified on a per-room basis via the Room.setDefaultClientClass method. Or, the custom class can be specified globally via the ClientManager class's setDefaultClientClass() method. When a class has been specified globally via setDefaultClientClass(), it is used as the client class for any client retrieved via ClientManager.getClient method with an unspecified scope.
Any custom class specified via Room's setDefaultClientClass() method overrides the global default client class. Similarly, any custom class specified via Client's setClientClass() method overrides the room and global default client class.
The global default client class. The class is normally a descendant of CustomClient.
Asks the server to stop watching for banned addresses. In response, the server no longer sends notifications when an addresses is banned or unbanned.
The result of a stopWatchingForBannedAddresses() request is returned via a ClientManagerEvent.STOP_WATCHING_FOR_BANNED_ADDRESSES_RESULT event.
Asks the server to stop watching for clients. In response, the server no longer sends notifications when a client connects or disconnects. The result of a stopWatchingForClients() request is returned via ClientManagerEvent.STOP_WATCHING_FOR_CLIENTS_RESULT.
Removes any ban currently in effect for the specified address (typically an IP address). By default, unban() requires administrator privileges. To allow other types of clients (such as moderators) to unban addresses, define a remote-client security rule.
The address to unban (typically an IP address).
Asks the server to send its list of banned client addresses, and then send notification any time an address is banned or unbanned. When the banned list is ready, ClientManager dispatches a ClientManagerEvent.SYNCHRONIZE_BANLIST event. Subsequently, when a client address is banned, ClientManager dispatches a ClientManagerEvent.ADDRESS_BANNED event and when a client address is unbanned, ClientManager dispatches a ClientManagerEvent.ADDRESS_UNBANNED event.
The result of a watchForBannedAddresses() request is returned via a ClientManagerEvent.WATCH_FOR_BANNED_ADDRESSES_RESULT event.
By default, watchForBannedAddresses() requires administrator privileges. To allow other types of clients (such as moderators) to access the banned address list, define a remote-client security rule.
Asks the server to send a list of clients currently connected to the server, and then send notification any time a client connects or disconnects. When the client list is ready, ClientManager dispatches a ClientManagerEvent.SYNCHRONIZE event. Subsequent client connections trigger a ClientManagerEvent.CLIENT_CONNECTED event. Subsequent disconnections trigger a ClientManagerEvent.CLIENT_DISCONNECTED event.
Clients that are added to the ClientManager's client list in response to watchForClients() do not have attributes loaded. To load attributes for a specific client, use Client.observe method or ClientManager.observeClient method. In the default configuration, attributes can also be loaded for a given client by joining a room containing that client.
As an alternative to watchForClients(), applications can maintain an arbitrary shared list of clients (with attributes automatically loaded or not) by creating an application room and then forcing all clients in the application to join that room. Clients wishing to load the list without being included in it can observe the application room and register for RoomEvent.ADD_OCCUPANT and RoomEvent.REMOVE_OCCUPANT events. Clients in the list can ignore client list updates by turning off updates for the room via the Room class's setUpdateLevels() method. In applications that wish to manage client lists, room-based client lists are normally more appropriate than watchForClients(). The watchForClients() method is intended for use primarily in cases where the list of rooms and clients on Union Server is not known in advance, and cannot be controlled (as is often true for server-administration applications). As a final alternative to watchForClients(), applications can use the ClientListSnapshot class to load a one-time list of clients on the server.
The result of a watchForClients() request is returned via a ClientManagerEvent.WATCH_FOR_CLIENTS_RESULT event.
The ClientManager class provides centralized access to Client instances, which represent clients connected to Union Server. Any client that is known to the current client (for example, a client in the same room as the current client) can be accessed via ClientManager.getClient method.