[erlang-questions] about websocket 76 in erlang

Per Melin per.melin@REDACTED
Fri Mar 11 15:05:36 CET 2011


On Fri, Mar 11, 2011 at 7:40 AM, zhangbo <bo.zhang86@REDACTED> wrote:
>        I've been writing a simple websocket(draft 76) server, but I caught a odd question. When open the html, the erlang console print "data Received:{tcp_closed,#Port<0.2108>}". But if I use jetty instead of erlang, it's ok. Please help. Thank you.

Works for me in Safari and Chrome (after I change the javascript to
open port 8000 instead of 8080).


>            function display() {
>                var valueLabel = document.getElementById("valueLabel");
>                valueLabel.innerHTML = "";
>                var ws = new WebSocket("ws://127.0.0.1:8080");
>                ws.onmessage = function(evt) {
>                        alert("msg:" + evt.data);
>                    valueLabel.innerHTML = evt.data;
>                };
>
>                ws.onclose = function() {
>                };
>
>                ws.onopen = function() {
>                        alert("open");
>                    ws.send("Hello, Server!");
>                };
>            }


More information about the erlang-questions mailing list