From 9b6985dafe71bb514509c16d2f35ebafc194f689 Mon Sep 17 00:00:00 2001 From: jomo Date: Mon, 22 Feb 2016 19:21:29 +0100 Subject: [PATCH] add accept-version header to CONNET frame From the STOMP 1.1 specs: > From STOMP 1.1 and onwards, the CONNECT frame MUST include the accept-version header. It SHOULD be set to a comma separated list of incrementing STOMP protocol versions that the client supports. If the accept-version header is missing, it means that the client only supports version 1.0 of the protocol. > The protocol that will be used for the rest of the session will be the highest protocol version that both the client and server have in common. This commit allows using version 1.1 and thus ACK/NACK, however this does not introduce protocol negotiation and will likely cause issues if the server does not support version 1.1. Also, please be aware that extra headers required by 1.1 (such as the SUBSCRIBE id) still need to be added manually. --- lib/client.js | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/lib/client.js b/lib/client.js index c6b851f..5d254bf 100644 --- a/lib/client.js +++ b/lib/client.js @@ -243,6 +243,10 @@ StompClient.prototype.onConnect = function() { 'passcode': self.pass }; + if (this.version !== '1.0') { + headers['accept-version'] = '1.0,1.1'; + } + if(this.vhost && this.version === '1.1') headers.host = this.vhost;