@@ -67,7 +67,6 @@ public class DefaultStompSession implements ConnectionHandlingStompSession {
6767
6868 private static final Message <byte []> HEARTBEAT ;
6969
70-
7170 static {
7271 StompHeaderAccessor accessor = StompHeaderAccessor .createForHeartbeat ();
7372 HEARTBEAT = MessageBuilder .createMessage (StompDecoder .HEARTBEAT_PAYLOAD , accessor .getMessageHeaders ());
@@ -93,6 +92,8 @@ public class DefaultStompSession implements ConnectionHandlingStompSession {
9392
9493 private volatile TcpConnection <byte []> connection ;
9594
95+ private volatile String version ;
96+
9697 private final AtomicInteger subscriptionIndex = new AtomicInteger ();
9798
9899 private final Map <String , DefaultSubscription > subscriptions = new ConcurrentHashMap <String , DefaultSubscription >(4 );
@@ -313,7 +314,12 @@ public Subscription subscribe(StompHeaders stompHeaders, StompFrameHandler handl
313314 @ Override
314315 public Receiptable acknowledge (String messageId , boolean consumed ) {
315316 StompHeaders stompHeaders = new StompHeaders ();
316- stompHeaders .setId (messageId );
317+ if ("1.1" .equals (this .version )) {
318+ stompHeaders .setMessageId (messageId );
319+ }
320+ else {
321+ stompHeaders .setId (messageId );
322+ }
317323
318324 String receiptId = checkOrAddReceipt (stompHeaders );
319325 Receiptable receiptable = new ReceiptHandler (receiptId );
@@ -407,6 +413,7 @@ else if (logger.isDebugEnabled()) {
407413 }
408414 else if (StompCommand .CONNECTED .equals (command )) {
409415 initHeartbeatTasks (stompHeaders );
416+ this .version = stompHeaders .getFirst ("version" );
410417 this .sessionFuture .set (this );
411418 this .sessionHandler .afterConnected (this , stompHeaders );
412419 }
0 commit comments