deepstream.io-client-js icon indicating copy to clipboard operation
deepstream.io-client-js copied to clipboard

Unsubscribing from Presence causes several client errors

Open termonio opened this issue 7 years ago • 3 comments

Setup

  • client: deepstream.io-client-js (v2.3.0)

  • server: deepstream.io (v3.1.0)

  • client code for subscribing and unsubscribing from Presence:

const deepstream = require('deepstream.io-client-js')

const client = deepstream('localhost:6030')

const userId = client.getUid()

client.on('error', (error, event, topic) => {
    console.log('client error')
    console.log(error, event, topic)
})

client.login({username: userId}, (success, data) => {
    console.log('login')
    console.log(success, data)
})

const presenceHandler = (conId, loggedIn) => {
    console.log(conId, loggedIn)
}

client.presence.subscribe(presenceHandler)

setTimeout(() => {
    client.presence.unsubscribe(presenceHandler)
}, 4000)

Expected Behavior

A user can subscribe (client.presence.subscribe(callback) ) and unsubscribe (client.presence.unsubscribe(callback) ) from Presence.

Actual Behavior

Client login and logouts are detected when subscribed to Presence as expected. However, when unsubscribing from Presence via client.presence.unsubscribe(presenceHandler) several errors are emitted:

client error
E UNSOLICITED_MESSAGE U
client error
[ 'INVALID_PRESENCE_USERS',
  'users are required to be a json array of usernames' ] 'INVALID_PRESENCE_USERS' 'U'
client error
No ACK message received in time for US ACK_TIMEOUT U

termonio avatar Jan 15 '18 14:01 termonio

bump

teckays avatar Jan 24 '18 09:01 teckays

Same here! Any updates on this issue?

BTW: I am NOT using the Javascript Client, but the Java Client.

StephanSchuster avatar Oct 13 '18 15:10 StephanSchuster

Meanwhile I found the issue on the server and created a pull request: https://github.com/deepstreamIO/deepstream.io/pull/915

StephanSchuster avatar Oct 15 '18 11:10 StephanSchuster