Giter Club home page Giter Club logo

Comments (12)

j78742 avatar j78742 commented on July 20, 2024

The connection shutdown at the time and then reconnected!

from sockette.

lukeed avatar lukeed commented on July 20, 2024

What do your event hooks look like? Sockette will terminate if it received 1000 or 1005 code. So I'm thinking there's something inside the event hooks that's preventing that.

from sockette.

raduciobanu22 avatar raduciobanu22 commented on July 20, 2024

I got the same issue. Calling close() doesn't seem to close the connection.

from sockette.

lukeed avatar lukeed commented on July 20, 2024

Can you guys try forcing a 1000 code during close?

ws.close(1000)

Also, please let me know what browsers & platforms you are/were experiencing this issue.

Thanks!

from sockette.

stevesweetney avatar stevesweetney commented on July 20, 2024

I'm experiencing the same issue on firefox in my react app.
The websocket object closes with code 1006 even when adding

ws.close(1000)

and then it will reconnect.

Also, on 2.0.3 I get unsupported operation error when using the close method

from sockette.

lukeed avatar lukeed commented on July 20, 2024

Thanks, interesting

Are you at all able to post a snippet or reproduction so that I can dig into it? Would love to squash this lingering issue

from sockette.

marcelschulze avatar marcelschulze commented on July 20, 2024

Got the same issue with react-native. It will automatically reconnect. @lukeed Do you have any experience with react native? I could provide a minimal setup to run in the ios simulator.

from sockette.

lukeed avatar lukeed commented on July 20, 2024

Sure, thank you. I only hear of this issue with RN, so it seems to be specific to that.

I'll poke thru the repro when you have it :) Thanks

from sockette.

marcelschulze avatar marcelschulze commented on July 20, 2024

Sorry for not providing some code... I had a quick look myself right now and it looks like the error code is always 1001, which is not handled in the onclose handler, so it is calling reconnect again.

1001 indicates that an endpoint is "going away", such as a server going down or a browser having navigated away from a page.

1001 is even happening if I do ws.close(1005). Very strange.

from sockette.

raduciobanu22 avatar raduciobanu22 commented on July 20, 2024

@lukeed any chance the PR related to this issue gets merged?
Many thanks in advance!

from sockette.

maxime-guyot avatar maxime-guyot commented on July 20, 2024

I'have reverse problem.
With AWS API gateway the connection as gone away after 10 minutes, Sockette receive 1001 code and does not reconnect ... !

from sockette.

lukeed avatar lukeed commented on July 20, 2024

@maxime-guyot sounds like a keep-alive problem. Clients should be pinging the service on an interval shorter than what the server is configured for, or the load balancer in your case.

1001 means something is going away, it doesn't specify client or server. And since every browser will disconnect with a 1001 code when navigating away from the current page, Sockette I can't keep trying to reconnect (since user left)

It's basically a matter of not handling client cleanup correctly versus the server cleaning up idle connections. Sockette can't do both, so it helps out by cleaning up after you and ensuring the client terminates correctly.

from sockette.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.