Skip to content
This repository has been archived by the owner on Oct 20, 2022. It is now read-only.

Session ID string not comform specification #7

Open
ErwinSteffens opened this issue Dec 11, 2014 · 1 comment
Open

Session ID string not comform specification #7

ErwinSteffens opened this issue Dec 11, 2014 · 1 comment

Comments

@ErwinSteffens
Copy link
Contributor

We're using Wamp.rt as our server wamp implementation and Jawampa (https://github.com/Matthias247/jawampa) as a client. There is a small incompatibility between the two.

Wamp.rt creates a session ID as a string value in the wamp messages. The Jawampa implementation parses the JSON message and checks if the ID can be converted to a long. This means it needs to be a number and therefore the message parsing fails and the connection is dropped.

When looking at the Wamp spec it says:

These are identified in WAMP using IDs that are integers between (inclusive) 0 and 2^53 (9007199254740992):

The reason to choose the specific upper bound is that 2^53 is the largest integer such that this integer and all (positive) smaller integers can be represented exactly in IEEE-754 doubles. Some languages (e.g. JavaScript) use doubles as their sole number type. Most languages do have signed and unsigned 64-bit integer types which both can hold any value from the specified range.
For reference, the following is a complete list of usage of IDs in the three categories for all WAMP Messages (see subsequent chapters).

When looking at the autobahn client which is also javascript it uses the following code to generate the ID which I think is better.

function newid () {
   return Math.floor(Math.random() * 9007199254740992);
}
@ghost
Copy link

ghost commented Dec 11, 2014

You're right. I don't have much time right now to change this, but feel free to send a patch.

ghost pushed a commit that referenced this issue Jan 6, 2015
Following Erwin Steffens recommendation (#7)
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant