Open marktani opened 6 years ago
Comment by kbrandwijk Monday Jul 10, 2017 at 23:07 GMT
Some ideas to get the thought train going:
getWebsocketConnections { count }
onConnect
, onClose
, onDisconnect
).subscription-transport-ws
SubscriptionClient
already has a connectionParams
parameter that is sent to the server in the server-side onConnect
event) so we can use this for grouping connections in our own function hooks, or use that to filter the query: getWebsocketConnection(filter: { metadata_contains: 'room=MyRoom' }) { count }
User
field with the supplied metadata and a timestamp, but that wouldn't work for unauthenticated connections.Comment by kbrandwijk Monday Jul 10, 2017 at 23:11 GMT
A current workaround would be:
onConnect
and onDisconnect
events on the SubscriptionClient
to execute some mutationonDisconnect
event didn't fire (browser closes, terminated connections, etc.)lastActive
field on every query as a sort of 'keepAlive' Comment by Plinpod Monday Jul 10, 2017 at 23:23 GMT
In Socket.IO 1.4+ you can get this count like this
var room = io.sockets.adapter.rooms['my_room'];
room.length;
and I was hoping to replicate a similar functionality. It would allow for the most accurate client count.
Comment by marktani Monday Sep 18, 2017 at 09:50 GMT
Related to https://github.com/graphcool/graphcool/issues/126
Issue by Plinpod Monday Jul 10, 2017 at 22:58 GMT Originally opened as https://github.com/graphcool/prisma/issues/307
It would be handy to be able to query and/or subscribe to a count of the currently active sessions with the backend or a count of the current subscribers to a particular table filter.