void setConnectionListener(Function listener)

Set a connestion listener for a provided service. The event listener will be called every time a client connects to the provided service.

Parameter Description
listener User defined callback function that is called on connection.

The connection listner is called with these arguments.

Argument Type Desription
connectionId DOMString Unique identifier of a connection.
service_name DOMString Service name of a provided service.
isSecure Boolean The connection is secure if the value true and false if not.
unique_name DOMString Unique name of the application or spacelet providing the service.

Every provided service can have a separate connection listener but one listener is enough if the service_name and isSecure arguments are utilized.

The connectionId is useful in managing multiple connections and especially so when used in combination with RPC requests to exposed methods. Every request to a exposed method gets an id in a Connection object. In this way it is easy to implement some connection specific logic.

copyright © 2014