Git Product home page Git Product logo

Comments (7)

zastrixarundell avatar zastrixarundell commented on June 20, 2024 1

omg I'm stupid

Yep, that about sums 1/2 of the problems when being a dev. Cheers!

from arduinowebsockets.

zastrixarundell avatar zastrixarundell commented on June 20, 2024

Haven't use this library in a long time but:

You are polling again which is fine but if it's true you again accept the connection, that would be an issue, no?

What happens when you only poll it, does it disconnect again?

from arduinowebsockets.

the-powl avatar the-powl commented on June 20, 2024

After accepting the first connection, the result of poll() is false, as expected, so therefore the if block doesn't get executed. Nevertheless the client gets disconnected.

from arduinowebsockets.

zastrixarundell avatar zastrixarundell commented on June 20, 2024

Okay, you're connecting first, then you are reading the message in a blocking manner and then you additionally wait one second. I don't see you sending a heartbeat to the server so maybe the server doesn't recognize you as connected anymore? I know that I had an issue like that and I was sending a heartbeat connection every second or so.

I used lambdas to receive messages from the client without actually stopping the main loop. Here's the directory with both my declaration and implementation if that helps/

Edit: Here's my loop as well.

from arduinowebsockets.

the-powl avatar the-powl commented on June 20, 2024

Unfortunately I'm not sure how to send a heartbeat and I don't just want to send random garbage. Shouldn't the TCP connection be maintained by the library itself or by an underlying level? Interestingly I can also wait more than 1 second... like 5 or even 10. The client gets only disconnected as soon when I call poll() again.

from arduinowebsockets.

zastrixarundell avatar zastrixarundell commented on June 20, 2024

from arduinowebsockets.

the-powl avatar the-powl commented on June 20, 2024

omg I'm stupid. I oversaw a websocket.close() in my partly copy and pasted javascript code which was responsible for closing the connection. I got suspicious when I tried to use another arduino library and it still didn't work 🤣. Thanks for help!

from arduinowebsockets.

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.