Warning: session_start(): open(/var/lib/php/sessions/sess_uqi5n2urb30jf6dt1idb2ibggn, O_RDWR) failed: No space left on device (28) in /var/www/tb-usercake/models/config.php on line 51
Warning: session_start(): Failed to read session data: files (path: /var/lib/php/sessions) in /var/www/tb-usercake/models/config.php on line 51
static WebSocketManager webSocketManager;
sclass WebSocketManager {
Set webSockets = synchroHashSet();
*() {
replaceCollection(webSockets, subBot_getMyWebSockets());
ifdef WebSocketManager_debug
print("Have " + n2(webSockets, "web socket") + ".");
endifdef
}
void onNewWebSocket(O ws, S uri) {
ifdef WebSocketManager_debug
print("New web socket!");
endifdef
webSockets.add(ws);
}
void onWebSocketMessage(O ws, S msg) {
ifdef WebSocketManager_debug
print("Got message: " + msg);
endifdef
}
void onWebSocketClosed(O ws) {
ifdef WebSocketManager_debug
print("Closed web socket");
endifdef
webSockets.remove(ws);
}
void sendToAllWebSockets(S msg) {
for (O ws : webSockets)
pcall(ws, 'send, msg);
}
Collection webSockets() {
ret cloneList(webSockets);
}
bool isEmpty() { ret empty(webSockets); }
void close(O ws) { call(ws, 'close); }
}
static void onNewWebSocket(O ws, S uri) {
if (webSocketManager != null)
webSocketManager.onNewWebSocket(ws, uri);
}
static void onWebSocketMessage(O ws, S msg) {
if (webSocketManager != null)
webSocketManager.onWebSocketMessage(ws, msg);
}
static void onWebSocketClosed(O ws) {
if (webSocketManager != null)
webSocketManager.onWebSocketClosed(ws);
}