warmcat / libwebsockets

canonical libwebsockets.org networking library
https://libwebsockets.org
Other
4.74k stars 1.48k forks source link

Ping not sent if no subprotocol is used #725

Closed lukasgeyer closed 7 years ago

lukasgeyer commented 7 years ago

When no subprotocol is used on a client connection (more specifically if the protocol of lws_client_connect_info is nullptr or does not match any protocol in protocols of lws_context_creation_info), which is quite fine according to RFC 6455 1.9, the automatic sending of ping using ws_ping_pong_interval does not work.

This seems to be because same_vh_protocol_list is empty when iterating over the virtual hosts in lib/service.c:744.

Is this working as intended? If so, what is the preferred way of using ping when no subprotocol shall be used?

lws-team commented 7 years ago

Is it maybe needing https://github.com/warmcat/libwebsockets/commit/586e42a827dd222b48ce21aceec88ed8cfd19f2d ?

lukasgeyer commented 7 years ago

Yes, thanks, this seems to solve the problem. I can confirm that ping is working using master at be9fb91 (which includes 586e42a).

What is the best option to get this commit into a stable branch on our end, is it possible to cherry-pick 586e42a on top of v2.1.0? Or is there any official release planned in the near future (I could not find any planned milestone)?

lws-team commented 7 years ago

You should follow v2.1-stable

https://github.com/warmcat/libwebsockets/commits/v2.1-stable

...if you want to stay on v2.1.

Any relevant fixes are already backported when the fix is made, including this one. Only fixes go on those branches, no new features.