deepstreamIO / deepstream.io-website

MIT License
10 stars 12 forks source link

`presence.getAll()` returns null for previous client connections #13

Closed apkostka closed 2 years ago

apkostka commented 5 years ago

Using 4.2.2 deepstream docker image with docker-compose, a 4.x client querying presence, and a 2.3.0 client logging in.

Client logs in with a username:

ds.login({ type: 'webhook', username: device_id }, (success, data) => { ...

Which does trigger a response from ds.presence.subscribe(device_id, (dev, login) => {...

However, if the client logs in, then deepstream (the docker container) is restarted, the initial call for getAll() returns null instead of an object:

ds.presence.getAll([device_id], (connections) => { ...
apkostka commented 5 years ago

Ok, I kind of figured this out. presence.getAll() actually returns 2 parameters, the first is null and the second is a list of connected clients (e.g. `[ 'user1', 'user2' ]). There's no indication that this is the case in the documentation, but I'm not sure what the first return parameter is.

apkostka commented 5 years ago

Additionally, it seems like when you specify a list of clients (ds.presence.getAll(['client1', 'client2'])), you get a different result type: an object with the client names as keys, rather than an array. That makes sense based on how they're used but probably needs to be documented. I'd be happy to make the PR if you'd like.

apkostka commented 5 years ago

In either case, I'm guessing this probably belongs in https://github.com/deepstreamIO/deepstream.io-client-js , since it seems to be on the client side.

yasserf commented 5 years ago

hey! can you please raise a PR against the website for this?

apkostka commented 5 years ago

PR is here: https://github.com/deepstreamIO/deepstream.io-website/pull/16