« Back to Product

Documentation

IPS_GetConnectionList

 array IPS_GetConnectionList ()

Returns

An array with one entry per connection. The order of the entries is not guaranteed. The structure is listed in the description.

Description

Warning

This function is intended for internal use only and may change or be removed at any time without notice.

The function returns the connections through which the web server sends data to clients. These are WebSocket connections (e.g. messages to visualizations) and proxy connections (proxied video streams). For each of these connections, Symcon maintains a send queue.

Key Type Description
Remote string IP address and port of the client, e.g. "192.168.1.20:52814"
ConnectionType string "WebSocket" or "Proxy"
ConnectedSince int Unix timestamp at which the first message was queued for the connection
Error bool TRUE if the connection has been marked as faulty because of an overflowing queue
QueueSize int Number of messages waiting in the queue for transmission
QueueBytes int Size of the waiting messages in bytes
TransferredCount int Number of all queued messages
TransferredBytes int Size of all queued messages in bytes
LastSuccessfulQueueing int Unix timestamp of the most recently queued message
LastSuccessfulTransfer int Unix timestamp of the most recently completed transmission

A connection is marked as faulty and does not receive any further messages if its queue contains more than 65,536 messages or 32 MB, or if no transmission has been completed for 5 minutes. If no transmission has been completed for 10 seconds, more than 32,768 messages or 8 MB are already sufficient. The specified limits are the default values.

Entries are only removed when no transmission has taken place for one hour. The list can therefore also contain connections which have already been closed. The number of currently open connections is returned by IPS_GetActiveWebSocketConnections and IPS_GetActiveProxyConnections.

Example

foreach (IPS_GetConnectionList() as $connection) {
    printf("%s (%s): %d messages queued, %d messages total%s\n", $connection['Remote'], $connection['ConnectionType'], $connection['QueueSize'], $connection['TransferredCount'], $connection['Error'] ? ', faulty' : '');
}

/* e.g. returns:
192.168.1.20:52814 (WebSocket): 0 messages queued, 1532 messages total
*/
Any questions?