[erlang-questions] https://github.com/joearms/ezwebframe

t x <>
Mon Mar 3 01:23:16 CET 2014


In case anyone else runs into this problem (either people on the list
or those finding the original question via Google). Here is the
problem + solution.

* in my setup, localhost = OSX
* server = virtual box session running ubuntu

Thus, I try to load up the webpage via:

  http://server:1456

this can load up the webpage, but the problem is that clock1.html
hardcodes "localhost", so it tries to open websocket at
"localhost:1456" rather than "server:1456"

Fixing this solved the problem (and the demos now work).


On Fri, Feb 28, 2014 at 11:09 PM, t x <> wrote:
> Hi,
>
>   I'm having some trouble trying to get
> https://github.com/joearms/ezwebframe to work.
>
> ###  In particular, on the server (Ubuntu 13), I get:
>
> :~/ezwebframe$ make
> rebar compile
> ==> Entering directory `/home/x/ezwebframe/deps/cowboy'
> ==> Entering directory `/home/x/ezwebframe/deps/cowlib'
> ==> cowlib (compile)
> ==> Leaving directory `/home/x/ezwebframe/deps/cowlib'
> ==> Entering directory `/home/x/ezwebframe/deps/ranch'
> ==> ranch (compile)
> ==> Leaving directory `/home/x/ezwebframe/deps/ranch'
> ==> cowboy (compile)
> ==> Leaving directory `/home/x/ezwebframe/deps/cowboy'
> ==> ezwebframe (compile)
> cd demos; make
> make[1]: Entering directory `/home/x/ezwebframe/demos'
> erlc -o ebin *.erl */*.erl
> svg/svg_pad4.erl:63: Warning: variable 'Y' is unused
> svg/svg_pad4.erl:204: Warning: variable 'L1' is unused
> svg/svg_pad4.erl:218: Warning: variable 'Id' is unused
> erl -pa ../deps/cowboy/ebin\
>             -pa ../deps/ranch/ebin\
>             -pa ../deps/cowlib/ebin\
>             -pa ../ebin\
>         -pa ./ebin\
>             -s ezwebframe_demos start
> Erlang R16B01 (erts-5.10.2) [source] [64-bit] [async-threads:10]
> [kernel-poll:false]
>
> a simple_demo of websockets....
> Load the page http://localhost:1456/ in your browser
> Starting:{ok,"/home/x/ezwebframe/demos"}
> Eshell V5.10.2  (abort with ^G)
> 1> websockets started on port:1456
> init:
> ezwebframe:handle "/"
> ezwebframe_demos::dispatch / => /home/x/ezwebframe/demos/
> mapped to:"/home/x/ezwebframe/demos/"
> init:
> ezwebframe:handle "/files"
> ezwebframe_demos::dispatch /files => /home/x/ezwebframe/demos/files
> mapped to:"/home/x/ezwebframe/demos/files"
> ezwebframe_demos::dispatch / => /home/x/ezwebframe/demos/
> init:
> ezwebframe:handle "/clocks/clock1.html"
> ezwebframe_demos::dispatch /clocks/clock1.html =>
> /home/x/ezwebframe/demos/clocks/clock1.html
> mapped to:"/home/x/ezwebframe/demos/clocks/clock1.html"
> init:
> init:
> ezwebframe:handle "/ezwebframe/websock.js"
> ezwebframe:handle "/common/jquery-1.7.1.min.js"
> init:
> ezwebframe_demos::dispatch /ezwebframe/websock.js =>
> /home/x/ezwebframe/demos/../priv/websock.js
> ezwebframe_demos::dispatch /common/jquery-1.7.1.min.js =>
> /home/x/ezwebframe/demos/common/jquery-1.7.1.min.js
> ezwebframe:handle "/clocks/clock1.css"
> mapped to:"/home/x/ezwebframe/demos/../priv/websock.js"
> mapped to:"/home/x/ezwebframe/demos/common/jquery-1.7.1.min.js"
> ezwebframe_demos::dispatch /clocks/clock1.css =>
> /home/x/ezwebframe/demos/clocks/clock1.css
> mapped to:"/home/x/ezwebframe/demos/clocks/clock1.css"
>
> ### On the client, when I load up the page with "Chrome 33.0.1750.117", I get:
>
>   "Socket closed -- your erlang probably crashed."
>
> ### Questions:
>
>   What should I try?
>
>
> Thanks!



More information about the erlang-questions mailing list