Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

connection state doesn't change depending on settings #314

Closed
WolframHempel opened this issue Jan 21, 2017 · 2 comments
Closed

connection state doesn't change depending on settings #314

WolframHempel opened this issue Jan 21, 2017 · 2 comments

Comments

@WolframHempel
Copy link
Member

battuashwik [8:11 PM]
@WolframHempel @yasserf i notice that the javascript client doesn't change state even when i turn off the deepstream server

[8:11]
ideally it should turn the connectionState to closed or error??

wolframhempel [8:13 PM]
that's strange - it should (and so far always reliably has) - it will change the state to reconnecting upon connectionloss

battuashwik [8:13 PM]
I have disabled reconnections by setting maxreconnectionAttempts to 0

[8:13]
i need a reconnecting strategy where it should continuously try ever 4 seconds

wolframhempel [8:14 PM]
ok...

battuashwik [8:14 PM]
currently u have only exponential backoff reconnecting strategy which wont work for me

wolframhempel [8:15 PM]
ok, first things first - you don't receive any connectionStateChanged events and getConnectionState() continues to return open even after the connection is lost?

battuashwik [8:15 PM]
that i haven't checked

[8:15]
i mean connectionStateChanged doesn't emit

[8:15]
i haven't checked the getConnectionState manually

[8:15]
i ll add a inteval timer and let you know in 5 min

wolframhempel [8:17 PM]
cheers - to achieve the reconnection behaviour you've described, could you configure your client with

maxReconnectAttempts: Infinity

battuashwik [8:19 PM]
uploaded this image: Screen Shot 2017-01-22 at 12.49.27 AM.png
Add Comment

battuashwik [8:20 PM]
connection state is open even when the server is shutdown

[8:21]
Ahh i will try that config

wolframhempel [8:22 PM]
thanks - We'll look into it. I'm wondering if there's something about the maxReconnectInterval setting at 0 that makes it believe its done reconnecting

@AlexBHarley
Copy link
Contributor

Confirmed a bug:

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

const client = deepstream('localhost:6020', {
  maxReconnectAttempts: 0,
  maxReconnectInterval: 1000
})
client.on('connectionStateChanged', console.log)
client.on('error', () => {})
client.login({})

results in:

AWAITING_CONNECTION
CHALLENGING
AWAITING_AUTHENTICATION
AUTHENTICATING
OPEN

and

client.getConnectionState() // OPEN

If we change maxReconnectAttempts: 1

AWAITING_CONNECTION
CHALLENGING
AWAITING_AUTHENTICATION
AUTHENTICATING
OPEN
RECONNECTING
ERROR

and

client.getConnectionState() // ERROR

Reason for this is that we only set the state to closed when we get the close event of a socket. Which doesn't seem to happen here.

@yasserf yasserf added this to the 4.0 milestone Jun 4, 2019
@yasserf
Copy link
Contributor

yasserf commented May 5, 2020

Closing due to inactivity and rewrite

@yasserf yasserf closed this as completed May 5, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

3 participants