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

Wireshark flooded with [PSH, ACK] packets when using websockets #36

Open
benkuper opened this issue Jun 18, 2020 · 7 comments
Open

Wireshark flooded with [PSH, ACK] packets when using websockets #36

benkuper opened this issue Jun 18, 2020 · 7 comments

Comments

@benkuper
Copy link

This line in Server::poll()
mg_iterate_over_connections(server, iterate_callback, &current_timer);

is sending packet to all websockets connection in a loop, which doesn't seem right.
I tested other websocket libraries and this behavior is not there. It may be related to the other issue I posted.
Generally, either I have no clue on how to use websockets in mongoose or there is something very wrong on how it's implemented :

  • data is sent out constantly at a very fast rate, even when no connection is active
  • websocketReady is called every time a packet is sent from an already connected socket
  • websocketData is not receiving everything, but receives ad vitam eternam the latest data sent
  • sending anything to a connected socket closes the connection with a 1006 status.

Am I missing something here ?? I'm not doing anything fancy, just trying out the library because it's one of the only ones to support both http request AND websocket, WITHOUT relying on Asio, but the websocket part is seems so broken...

Thank you in advance

@Gregwar
Copy link
Owner

Gregwar commented Jun 18, 2020

Hello,
I am sorry but it is unlikely I can investigate this

However, note that this repo is only a binding over https://github.com/cesanta/mongoose/ which is a C web server, and it's been a while it was not updated.

You should consider:

  1. Trying if your issue also exists in the C version
  2. If it does, report it over there opening an issue
  3. If it doesn't, consider either switching to C or updating those bindings to match upstream mongoose

@Gregwar
Copy link
Owner

Gregwar commented Jun 18, 2020

(And I would not be surprised if the WebSockets part is broken, however I am sorry that you will have to investigare further yourself if you want to get at the bottom of this 😅)

@benkuper
Copy link
Author

No worries, thank you for answering already, this is the bigger part of knowing how to handle the situation :) I'm in a similar position myself with little time to dedicate on other people's problems.
FYI, my end goal is to integrate it in my software : http://benjamin.kuperberg.fr/chataigne to be able to expose the user-customizable dashboard to a webpage with live control.

Thank you for the info, if I find something I'll post it here (but it's likely that I'm switching over websocketpp ;)

@Gregwar
Copy link
Owner

Gregwar commented Jun 18, 2020

This project looks good!
But indeed you should consider switching to a maintained project for websockets

There is also Qt itself providing an implementation, this is a way much more serious lead
https://doc.qt.io/qt-5/qtwebsockets-index.html

@benkuper
Copy link
Author

Thank you :)
Chataigne is based on JUCE, not Qt so I can't use it :)

@Gregwar
Copy link
Owner

Gregwar commented Jun 18, 2020

And what is your problem with boost ?

@benkuper
Copy link
Author

I managed to not have it as a dependency for the whole project, and I really want to try without, because it will just make it much more heavy and painful to maintain / collaborate.

Right now, everything is pretty much working on its own (with the JUCE dependency), so when you want to get on it, even though it's a pretty big piece of code, it's quite easy to get started and work.
I'm afraid that including boost would just make a lot of things more complicated.

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

2 participants