lipp / lua-websockets

Websockets for Lua.
http://lipp.github.com/lua-websockets/
MIT License
396 stars 113 forks source link

Unsupported protocol: "null" using http://www.websocket.org/echo.html #23

Closed rohitjoshi closed 11 years ago

rohitjoshi commented 11 years ago

Hi @lipp, When I use http://www.websocket.org/echo.html to test the ws:// request,

  1. Connection is established successfully
  2. Message is sent to the lua-websockets server
  3. I see "Unsupported protocol: "null" on server side
  4. No response received. Same test work fine with tornado.

If I try using my local javascript, it works fine.

function WebSocketTest() { if ("WebSocket" in window) { alert("WebSocket is supported by your Browser!"); // Let us open a web socket var ws = new WebSocket("ws://ipaddress:8080/", 'echo');

 ws.onopen = function()
 {
    // Web Socket is connected, send data using send()
    ws.send('{"id":"dsfsdf", "body":"Rock it with HTML5 WebSocket"}');
    alert("Message is sent...");
 };
 ws.onmessage = function (evt)
 {
    var received_msg = evt.data;
    alert("Message is received..." );
    alert("received:" + received_msg)
 };
 ws.onclose = function()
 {
    // websocket is closed.
    alert("Connection is closed...");
 };

 ws.onerror = function(evt)
 {
    // Web Socket error
    var msg_error = evt.error;
    alert("error:");
    alert(msg_error);
 };

} else { // The browser doesn't support WebSocket alert("WebSocket NOT supported by your Browser!"); } }

lipp commented 11 years ago

@rohitjoshi sorry, my fault (default handler must be set). fixed on master: 5b8ff0b0 c61001e7