Always set heart-beat header in STOMP CONNECTED frames

Since SPR-10954, the SimpleBrokerMessageHandler supports `heart-beats`.

Even if the STOMP spec states that the `heart-beat` header is OPTIONAL,
and if absent considered as `heart-beat: 0,0`,
some clients rely on this to be set in CONNECTED frames.

This commit adds this header information even if no task
scheduler/heart-beat have been configured.

See: https://stomp.github.io/stomp-specification-1.2.html#Heart-beating

Issue: SPR-10954
This commit is contained in:
Brian Clozel
2015-05-05 16:09:42 +02:00
parent 76faa2c6d2
commit 4b07bc39da
2 changed files with 21 additions and 0 deletions

View File

@@ -449,6 +449,8 @@ public class StompSubProtocolHandler implements SubProtocolHandler, ApplicationE
long[] heartbeat = (long[]) connectAckHeaders.getHeader(SimpMessageHeaderAccessor.HEART_BEAT_HEADER);
if (heartbeat != null) {
connectedHeaders.setHeartbeat(heartbeat[0], heartbeat[1]);
} else {
connectedHeaders.setHeartbeat(0, 0);
}
return connectedHeaders;
}