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

Detect websocket disconnecting #100

Open
indapublic opened this issue Dec 7, 2018 · 0 comments
Open

Detect websocket disconnecting #100

indapublic opened this issue Dec 7, 2018 · 0 comments

Comments

@indapublic
Copy link

indapublic commented Dec 7, 2018

I'm using
"reconnecting-websocket": "^4.1.10"
in React Native project.

My code for websocket initializing:

this.ws = new ReconnectingWebSocket(this.url)
this.ws.onopen = connectedHandler
this.ws.onclose = disconnectedHandler
this.ws.onerror = disconnectedHandler
this.ws.addEventListener('error', (e) => {
    disconnectedHandler()
})
this.ws.addEventListener('close', (e) => {
    disconnectedHandler()
})
this.ws.addEventListener('open', (e) => {
    connectedHandler()
})

So I will call disconnectedHandler for close and error events.

But those events not fired when I lost my connection

screen shot 2018-12-08 at 00 48 01

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant