please I need your help I'm creating an app and I want to send data through websockets but I do not know how to receive the data and create a page to send example: pagEnvia.html and I want to receive the data in my index.php I have this code that I got on the internet but I do not understand the reception of the message.
How do I do it?
<script type="text/javascript">
var ws;
function initSocket(){
ws = new WebSocket("wss://echo.websocket.org");
ws.onopen = function(event){
alert('Conexion Abierta');
//ws.send('{"setID":"Realbingo90","passwd":"12345"}');
setInterval(function(){
ws.send("hola mundo");
}, 1000);
}
ws.onmessage = function(event){
console.log(event.data);
}
ws.onclose= function(){
alert('Cerrado');
}
}
initSocket();
I need your prompt help.