Get new client ID at every refresh :(
Hi, I have a litle problem whith you nice Websocket library. After the site refresh the client get a new connection ID. I need to select the clients by IP address. So I need to loop the clients but i could not, because I don't know the correct IDs. First connection ID is 1 but after a refresh the 1th ID dead and the new ID is the 2. and so on. I don't want to loop on ID-s if I can get the connected cliens id-s from the class via a new public method or any other solution would be more the nice for me. if I could figure out the all connected clients ID-s. :) th
Try assigning a client ID in the client and sending it to the server to store in an array. I'm doing this in a websocket app with
function onLoad(evt) { clientID = Date.now(); // Should be unique for each client initWebSocket(); initElements(); initListeners(); }
and then having the server request clientID, where the client responds with
websocket.send(JSON.stringify({ client: clientID}));
Hopefully this is also possible without websocket.