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

Support version negotiation completely #12

Closed
dantman opened this issue Apr 4, 2013 · 1 comment
Closed

Support version negotiation completely #12

dantman opened this issue Apr 4, 2013 · 1 comment
Labels

Comments

@dantman
Copy link
Collaborator

dantman commented Apr 4, 2013

Right now it doesn't look like stompest properly supports version negotiation.

StompConfig only supports a single version. And trying to use the versions parameter to connect on the sync client results in: StompProtocolError: Invalid versions: ['1.1'] [version=1.0]

Also ideally when version(s) is left as None we should not default to 1.0. Instead in that case we should include every version natively supported by stompest into accepts-version. And then use the version specified by the server in the CONNECTED header. So we can properly use the most recent version supported by both the server and stompest.

@nikipore
Copy link
Owner

nikipore commented Apr 5, 2013

stompest does properly negotiate versions (example is run against ActiveMQ 5.7, for more examples I recommend that you look at the unit tests):

>>> from stompest.config import StompConfig
>>> from stompest.protocol import StompSpec
>>> from stompest.sync import Stomp
>>> config = StompConfig('tcp://localhost:61613', version=StompSpec.VERSION_1_1)
>>> client = Stomp(config)
>>> client.connect()
>>> client.session.version
u'1.1'

You obtain the desired behavior by specifying StompConfig(uri, version=StompSpec.VERSION_1_2). I think that an implicit upgrade of the STOMP versions is not a good idea because you lose control over the features which are in use, and not all protocol changes are fully backward compatible. If you use the latest of StompSpec.VERSIONS, the definition StompConfig(uri, version=StompSpec.VERSIONS[-1]) of the config becomes generic.

@nikipore nikipore closed this as completed Apr 5, 2013
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

2 participants