JSteunou / webstomp-client

Stomp client over websocket for browsers
Apache License 2.0
299 stars 59 forks source link

Bug in utils.js createId(), may create duplicate subscription id's #91

Open hakjac opened 4 years ago

hakjac commented 4 years ago

The createId() method is supposed to create unique subscription ids, but as it is implemented today it may create duplicate id's when several id's is generated during the same millisecond, since it just appends a random number between 0-1000 to the current millisecond.

The method must ensure to never return an id that previously been returned. There are several options of doing this, e.g. keeping track and checking against the id's generated for the current millisecond is one way.