boazsegev / iodine

iodine - HTTP / WebSockets Server for Ruby with Pub/Sub support

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Disable sending of WebSocket ping with `-ping 0` parameter on Iodine command line

fabio opened this issue · comments

commented

System Information

  • OS: macOS 10.13.6, Debian GNU/Linux 4.19.0-12-amd64
  • Ruby: 3.0.0
  • Version: 0.7.43
  • OpenSSL: 1.1.1i 8 Dec 2020

Description

The Iodine command line param -ping takes number of seconds interval to send a WebSocket ping packet to the client. Setting it to 0 will produce a ping after 255 seconds interval.

Expected behavior

Setting -ping to 0 should disable the sending of ping packets.

Actual behavior

Setting -ping to 0 will produce a ping after 255 seconds interval.

commented

Hi @fabio ,

Thank you for opening this issue.

However, I'm not sure I probably understood your concern.

The ping is required in order to test the connection's health. When a ping fails, than the socket resources are cleared away. If no pings are ever sent, then the application might slowly leak file descriptors until there are no more system resources left for the server. This might also expose the server to DoS attacks based on TCP/IP protocol weaknesses (which the ping is meant to resolves)... this is the same as the HTTP timeout (which always exists and can't be disabled), as disabling this feature will result in a security concern.

I'm not sure if that's what you meant, but did you intend to disable the connection timeout review?

Kindly,
Bo.

commented

Hi Bo,

Thank you for your quick reply and your effort with Iodine.

I imagined you could disable the WebSocket ping, but if it is needed to clear unused resources and to improve security, ignore my issue.

Kind Regards,
-- fabio

commented

Glad to help 👍🏻

P.S.

Please note that the ping, when sent, is the WebSocket protocol ping and doesn't send any WebSocket messages to the client (you won't get a JSON style {"event":"ping"} message from this ping frame).

I have some questions related to ping and pong. I'm connecting from the Java-Websocket client but the client keeps saying that it doesn't receive any pong from our server. Do I need to do something from my server to pong the client when it ping?

commented

Hi @lucaskuan ,

Thank you for raising this concern.

Please consider opening a new issue, so Fabio (who opened the original issue) isn't consistently notified about this new issue.

I would also appreciate more details as well as a way for me to reproduce the issue, so I can solve it.

For example, how does the Java-WebSocket send ping? Does it send ping as specified by the WebSocket protocol specifications, or does it send a WebSocket client message (such as JSON) with a ping payload?

Thank you kindly,
Bo.

commented

This issue could be closed for me, since Bo's answer was exhaustive.

I don't know if it remained open for other reasons or simply because I should have closed it (in the first case, you will reopen it).

-- fabio