I'm trying this simple websocket example on Google Chrome:
var wsUri = "ws://echo.websocket.org/";
var output;
function init() {
output = document.getElementById("output");
testWebSocket();
}
function testWebSocket() {
websocket = new WebSocket(wsUri);
websocket.onopen = function(evt) {
onOpen(evt)
};
..............
..............
function onOpen(evt) {
writeToScreen("CONNECTED");
doSend("WebSocket rocks");
}
function onClose(evt) {
writeToScreen("DISCONNECTED");
}
window.addEventListener("load", init, false);
But i always receive only DISCONNECT!
There is something wrong?
Do I have to enable WebSockets protocol in my local Apache? If yes how to?