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

Heartbeat configuration in the default stomp server handler appears to be incorrect #40

Open
morganmcc opened this issue May 29, 2018 · 0 comments

Comments

@morganmcc
Copy link

If a client connects to the STOMP server with this heartbeat header:
heart-beat:30000,300000

The server then might respond with:
heart-beat:300000,30000

This should result in the client sending a heartbeat every 30 seconds (max of c.x, s.y), and the server sending a heartbeat every 5 minutes (max of c.y, s.x).

By default it appears that the Stomp server handler will in this situation send a heartbeat every 30 seconds and expect one from the client every 5 minutes. I think this is because the API is slightly confusing. The following call will compute the heartbeat interval for the STOMP client.

Frame.Heartbeat.computePingPeriod(
Frame.Heartbeat.parse(frame.getHeader(Frame.HEARTBEAT)),
Frame.Heartbeat.create(connection.server().options().getHeartbeat()));

The resulting value is then passed in to the connection.configureHeartbeat function as the first parameter, which is the server heartbeat ping time. Basically, these need to be reversed either by reversing the parameters passed to that configureHeartbeat or change the way the handler is calculating ping/pong.

deepsleep added a commit to deepsleep/vertx-stomp that referenced this issue Jul 7, 2018
… and DefaultStompHandler.

2. Add unit test testAsymmetricHeartbeatTime to StompClientImplTest.
cescoffier added a commit that referenced this issue Jul 9, 2018
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Development

No branches or pull requests

1 participant