I want to create a Websocket based client-server Application. In that I\'m created node js websocket server which is waiting for the clients. Now I want to create react js w
Just create rest program from server side and create the connection at a Web page.
var connection = new WebSocket('ws://localhost/echo', ['soap', 'xmpp']);
opening the connection
connection.onopen = function () {
connection.send('Ping'); //
};
connection.onerror = function (error) {
console.log('WebSocket Error ' + error);
};
//to receive the message from server
connection.onmessage = function (e) {
console.log('Server: ' + e.data);
};
// Sending String
connection.send('your message');
At server side you will get session and message, So you can do communication with N sessions.