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

Session ID string not comform specification #7

@ErwinSteffens

Description

@ErwinSteffens

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);
}

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions