Closed vksdgreat closed 8 years ago
Hello, If i got it right, you want the client to identifies himself to server. Then you'll have to send that information via javascript
var clientid = 'xx';
socket.send(clientid);
I would recommend sending data in json format, it will be much easier to handle in server side. Then you should try something like this
var clientid = 'xx';
var json = '{"task":"auth","clientid":clientid}';
socket.send(json);
If this information is really important, and you need it as soon the client is connected, put this code inside socket.onopen event.
You'll need to extend the WebSocketClient class to add custom fields to a connection.
Thank you LGaitan i will try this
Hello, I am planning to connect this websocket with my database, so I am putting my database code in server.php file. but i did not want to send and autogenerated clientId instead i want to send clientId registered in database so i want to know how to send a client id from index.html to server.php?