| 15 | } |
| 16 | |
| 17 | void VisConnector::newWebSocketClient(QWebSocket* socket) |
| 18 | { |
| 19 | _clients << socket; |
| 20 | connect(socket, &QWebSocket::disconnected, this, &VisConnector::webSocketClientDisconnected); |
| 21 | connect(socket, &QWebSocket::textMessageReceived, this, &VisConnector::webSocketMessageReceived); |
| 22 | QJsonObject obj({{"event", "init"}, |
| 23 | {"windows", _windows}, |
| 24 | {"numSolutions", _solutions.isEmpty() ? 0 : _solutions.first().size()}}); |
| 25 | auto json = QString::fromUtf8(QJsonDocument(obj).toJson()); |
| 26 | socket->sendTextMessage(json); |
| 27 | } |
| 28 | |
| 29 | void VisConnector::webSocketClientDisconnected() |
| 30 | { |