Skip to content

Conversation

@jomo
Copy link

@jomo jomo commented Feb 22, 2016

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 PR allows using version 1.1 and thus ACK/NACK.

However, this does not introduce protocol negotiation and will likely cause issues in case the server does not support protocol 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, e.g:

var Stomp = require("stomp-client");

var stomp_client = new Stomp({
  // ...
  protocolVersion: "1.1"
});

var sub_id = "foobar";
var headers = {
  ack: "client-individual",
  id: sub_id,
};

stomp_client.subscribe("/queue/example", headers, function(body, headers) {
  var message_id = headers["message-id"];

  if (success(body)) {
    stomp_client.ack(message_id, sub_id);
  } else {
    stomp_client.nack(message_id, sub_id);
  }
};

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.
@jomo
Copy link
Author

jomo commented Dec 3, 2017

Closing in favor of #64

@jomo jomo closed this Dec 3, 2017
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant