Server class.
Note: Most of the API in this class is not thread-safe and intended to be called
only from the main worker thread with the one exception: Server.work()
.
read only configLogTime:Bool
Cached configuration variable. If set to true, will log time spent on each client request.
read only redis1:Redis
Redis connection to persistent project database (10+, has to be selected). Use only from main server thread.
read only redisNotify:Redis
Redis connection to entity notification database (3). Use only from main server thread.
inline disconnect (c:ClientInfo):Void
Immediately disconnects a client and triggers disconnect hooks.
Parameters:
c
Client.
getClientByConnectionID (id:Int):ClientInfo
Returns client by his connection id.
Parameters:
id
Connection ID.
Returns:
Client. Returns null, if no such client is online.
inline log (projectID:String, type:String, s:String):Void
Adds a typed message to server log.
Parameters:
projectID
Message project ID.
type
Message type.
s
Message to log.
Returns next available row ID from sequence for given database table.
Parameters:
t
Database table name.
Returns:
Next available row ID.
inline pending (q:String):Void
Adds SQL query to the queue for later execution and immediately returns.
Parameters:
q
SQL query string.
inline query (q:String):List<Dynamic>
Sends request to cache server and waits for response.
Parameters:
params
Request parameters.
Should have the _type
field that sets the request type in the <module>.<method>
format.
Returns:
Cache server response parameters.
inline queryTrace (q:String):List<Dynamic>
Runs SQL query in database and logs it in trace log.
Parameters:
q
SQL query string.
Returns:
A list of results if the query is of SELECT type. Null otherwise.
inline quote (s:String):String
Escapes a string for using in SQL query as a row field.
Parameters:
s
String.
Returns:
Escaped string.