Client information class.
read only connectionID:Int
Unique connection ID. Used for asynchronous responses when the client did not login yet.
Set to true by the server when the client socket is connected. Treat as read-only in most cases. Used for notifications.
Client language. In the case of game server it is set to a given language on successful client login.
dynamic callPost (type:String, params:Params, response:Dynamic):Void
Called after each client request. Needs to be overriden.
Parameters:
type
Request type.
params
Request parameters.
response
Request response. Can be modified.
inline get (name:String):Dynamic
Returns client variable value. Client variables live only until the end of session.
Parameters:
name
Variable name.
Returns:
Variable value. Returns null if the variable does not exist.
Returns client variable value as Bool
.
Client variables live only until the end of session.
Parameters:
name
Variable name.
Returns:
Variable value. Returns false if the variable does not exist.
Returns client variable value as Float
.
Client variables live only until the end of session.
Parameters:
name
Variable name.
Returns:
Variable value. Returns 0 if the variable does not exist.
Returns client IP address.
Returns:
Client IP address. If socket is not connected, returns an empty string.
If socket is null, returns ?dc?
string.
Returns client variable value as Int
.
Client variables live only until the end of session.
Parameters:
name
Variable name.
Returns:
Variable value. Returns 0 if the variable does not exist.
getString (name:String):String
Returns client variable value as String
.
Client variables live only until the end of session.
Parameters:
name
Variable name.
Returns:
Variable value. Returns an empty string if the variable does not exist.
Returns true if this client has a local IP address.
Returns:
True, if this client has a local IP address. False otherwise.
inline notify (msg:Dynamic):Void
Adds message to notification queue.
Any pending notifications will be sent with the next client response in serverNotify
parameter as a List<Dynamic>
.
Each 3 seconds the server checks if there are any messages in the notification queue.
If there are, the client response with the type server.notify
is sent.
Parameters:
msg
Notification to send to client.
response (type:String, params:Dynamic):Void
Sends response to this client. This method is thread-safe.
Note: If the client is not online, this method will fail silently.
Parameters:
type
Response type.
params
Response parameters.