-
Notifications
You must be signed in to change notification settings - Fork 1.2k
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
HTTP: periodically send WebSocket heartbeat TEXT frames, a la socket.io #3929
Comments
Similar mechanism exists in STOMP protocol as well, but with different heartbeat messages: STOMP docs: https://stomp.github.io/stomp-specification-1.2.html |
@katerina-stepanova thanks for the info |
Hello @slandelle , with Engine.IO 4 release, socket.io reversed heartbeat mechanism. Now server is sending Our app heavily utilizes socket.io and this change is a nightmare to work with in gatling. Before, we were managing pings by ourselves, but at least we were in control when to send them. Now, I'm sending blind pongs and it kinda works, but not really in complex scenarios. There are two main issues:
I found https://github.com/gatling/gatling/blob/main/gatling-http-client/src/main/java/io/gatling/http/client/impl/WebSocketHandler.java#L140 and maybe something like this could fix it, but there should by also some kind of socket.io detection as well I guess..
|
Some WebSocket implementations require low level automatic replies from clients to specific messages, for example for heartbeat purposes. This commit introduces two new WebSocket options: `wsAutoReplyTextFrame` and `wsAutoReplySocketIo4`. The `wsAutoReplyTextFrame` is generic, it accepts `f: PartialFunction[String, String]` as a parameter and allows configuration of custom reponse for specific message, for example: `{ case "ping" => "pong" }` The `wsAutoReplySocketIo4` is utilizing `wsAutoReplyTextFrame` with pre-configured heartbeat mechanism introduced in Engine.IO v4. It automatically replies with pong message (`3`) to server ping message (`2`).
socket.io uses a specific heartbeat mechanism based on Data frames (as JavaScript WebSocket API doesn't have access to Ping and Pong frames). See https://socket.io/docs/ "Disconnection detection".
Client will send
2
to server that will respond with3
.Default period is 25s.
As socket.io is a very standard WebSocket framework, it would be nice to support such mechanism out of the box.
The text was updated successfully, but these errors were encountered: