I'm trying to use WebSockets in PHP and Javascript and I'm confused, it uses the ws: // and wss: // protocol and the hostgator ) do not have these protocols enabled (I think!) and I can not connect, does anyone know if I need to enable these protocols on the server or how do I make the connection?
I tried connecting to another server that I found in examples and I ...
Here is the code (with server running):
<script>
var connection = new WebSocket('ws://echo.websocket.org/')
connection.onopen = function(e) {
alert("Connected");
console.log("Connected");
};
connection.onclose = function(e) {
alert("Connection closed");
console.log("Connection closed");
};
</script>
EDIT: Is it possible to stream audio using websockets?