Mercurial > code > home > repos > rdfdb
changeset 57:bcaba1620128
sent connectionid to clients for them to display, for debugging
Ignore-this: b746e24b517e68ab77f3e293888e0613
author | Drew Perttula <drewp@bigasterisk.com> |
---|---|
date | Thu, 30 May 2019 08:18:57 +0000 |
parents | 7293dbfe54a4 |
children | 263e1de4fee6 |
files | rdfdb/service.py |
diffstat | 1 files changed, 3 insertions(+), 4 deletions(-) [+] |
line wrap: on
line diff
--- a/rdfdb/service.py Thu May 30 08:18:12 2019 +0000 +++ b/rdfdb/service.py Thu May 30 08:18:57 2019 +0000 @@ -379,7 +379,7 @@ {}).update(suggestion['prefixes']) -_wsClientSerial = 0 +_wsClientSerial = itertools.count(0) class WebsocketClient(cyclone.websocket.WebSocketHandler): @@ -387,11 +387,10 @@ wsClient: Optional[WsClient] = None def connectionMade(self, *args, **kwargs) -> None: - global _wsClientSerial - connectionId = f'connection-{_wsClientSerial}' - _wsClientSerial += 1 + connectionId = f'WS{next(_wsClientSerial)}' self.wsClient = WsClient(connectionId, self.sendMessage) + self.sendMessage(json.dumps({'connectedAs': connectionId})) log.info("new ws client %r", self.wsClient) self.settings.db.addClient(self.wsClient)