Your code looks absolutely correct to me.
I just made a couple of minor changes:
var myClient1 = connect("http://localhost:8080","WELCOME");
var myClient2 = connect("http://localhost:8080", "WELCOME")
const lsSubscribe = (lsClient, prefix) => {
console.log(prefix + " - " + obj.getValue("stock_name") + ": " + obj.getValue("last_price"));
lsSubscribe(myClient1, "1")
lsSubscribe(myClient2, "2")
and testing it works fine, this is my output:
CONNECTING
CONNECTING
CONNECTED:STREAM-SENSING
CONNECTED:STREAM-SENSING
CONNECTED:WS-STREAMING
CONNECTED:WS-STREAMING
SUBSCRIBED
SUBSCRIBED
1 - Anduct: 2.93
1 - Bagies Consulting: 7.24
1 - Ations Europe: 15.98
2 - Anduct: 2.93
2 - Bagies Consulting: 7.24
2 - Ations Europe: 15.98
2 - Ations Europe: 16.04
1 - Ations Europe: 16.04
2 - Ations Europe: 15.9
1 - Ations Europe: 15.9
2 - Ations Europe: 15.77
1 - Ations Europe: 15.77
1 - Ations Europe: 15.89
2 - Ations Europe: 15.89
1 - Ations Europe: 16.01
2 - Ations Europe: 16.01
1 - Bagies Consulting: 7.19
2 - Bagies Consulting: 7.19
2 - Ations Europe: 16.09
1 - Ations Europe: 16.09
2 - Ations Europe: 16.03
1 - Ations Europe: 16.03
1 - Ations Europe: 16.12
2 - Ations Europe: 16.12
2 - Ations Europe: 15.98
1 - Ations Europe: 15.98
the first 3 updates for each client are the snapshot, and it makes sense that they come in bulk for the two clients, then there is the alternation.
Did you expect something different?
Regards,
Giuseppe