marcelog / erws Goto Github PK
View Code? Open in Web Editor NEWErlang Websockets example using Cowboy
Erlang Websockets example using Cowboy
erws ==== Example of using cowboy to handle websocket connections. This is the sourcecode for this article: http://erlang.org.ar/WebsocketsConCowboy You can find the english version here: http://marcelog.github.com/articles/erlang_websocket_server_cowboy_tutorial.html Thanks ====== McClain Looney: @mlooney for updating the code to cowboy 0.9
First, thanks for publishing this. There is so little documentation on Cowboy (and few examples that work) that it's hard to get a leg up.
This is a minor nit, but for a neophyte it may be good to put in README or Makefile:
I needed to do a ./rebar get-deps before make would compile. Got unavailable dependencies.
I'm trying to run this example but it crashes.
Steps:
$ git clone git://github.com/marcelog/erws.git
Cloning into 'erws'...
remote: Counting objects: 43, done.
remote: Compressing objects: 100% (29/29), done.
remote: Total 43 (delta 12), reused 43 (delta 12)
Receiving objects: 100% (43/43), 118.93 KiB | 97 KiB/s, done.
Resolving deltas: 100% (12/12), done.
$ cd erws
$ ./rebar get-deps
==> erws (get-deps)
Pulling cowboy from {git,"git://github.com/extend/cowboy.git",{tag,"0.6.1"}}
Cloning into 'cowboy'...
Pulling lager from {git,"git://github.com/basho/lager.git","master"}
Cloning into 'lager'...
==> cowboy (get-deps)
==> lager (get-deps)
giovanni@thinkpad:~/Projects/erlang/erws$ make
./rebar compile
==> cowboy (compile)
Compiled src/cowboy_http_handler.erl
Compiled src/cowboy_http_websocket_handler.erl
Compiled src/cowboy_protocol.erl
Compiled src/cowboy_acceptor.erl
Compiled src/cowboy_app.erl
Compiled src/cowboy_dispatcher.erl
Compiled src/cowboy_sup.erl
Compiled src/cowboy_listener_sup.erl
Compiled src/cowboy_listener.erl
Compiled src/cowboy_http_websocket.erl
Compiled src/cowboy_clock.erl
Compiled src/cowboy_bstr.erl
Compiled src/cowboy_acceptors_sup.erl
Compiled src/cowboy.erl
Compiled src/cowboy_http.erl
Compiled src/cowboy_http_req.erl
Compiled src/cowboy_ssl_transport.erl
Compiled src/cowboy_cookies.erl
Compiled src/cowboy_multipart.erl
Compiled src/cowboy_requests_sup.erl
Compiled src/cowboy_http_static.erl
Compiled src/cowboy_client.erl
Compiled src/cowboy_tcp_transport.erl
Compiled src/cowboy_http_protocol.erl
Compiled src/cowboy_http_rest.erl
==> lager (compile)
Compiled src/lager_util.erl
Compiled src/lager_transform.erl
Compiled src/lager_sup.erl
Compiled src/lager_crash_log.erl
Compiled src/lager_trunc_io.erl
Compiled src/lager_console_backend.erl
Compiled src/error_logger_lager_h.erl
Compiled src/lager_msg.erl
Compiled src/lager_default_formatter.erl
Compiled src/lager_config.erl
Compiled src/lager_handler_watcher_sup.erl
Compiled src/lager_handler_watcher.erl
Compiled src/lager_app.erl
Compiled src/lager.erl
Compiled src/lager_stdlib.erl
Compiled src/lager_format.erl
Compiled src/lager_file_backend.erl
==> erws (compile)
Compiled src/erws_app.erl
Compiled src/erws_sup.erl
Compiled src/erws_handler.erl
cd rel && ../rebar generate && cd -
==> rel (generate)
/home/giovanni/Projects/erlang/erws
./rebar compile
==> cowboy (compile)
==> lager (compile)
==> erws (compile)
$ make run
rel/erws/bin/erws start
Crash dump was written to: erl_crash.dump
init terminating in do_boot ()
$ make runconsole
rel/erws/bin/erws console
Exec: /home/giovanni/Projects/erlang/erws/rel/erws/erts-5.9.2/bin/erlexec -boot /home/giovanni/Projects/erlang/erws/rel/erws/releases/1/erws -mode embedded -config /home/giovanni/Projects/erlang/erws/rel/erws/releases/1/sys.config -args_file /home/giovanni/Projects/erlang/erws/rel/erws/releases/1/vm.args -- console
Root: /home/giovanni/Projects/erlang/erws/rel/erws
Erlang R15B02 (erts-5.9.2) [source] [smp:4:4] [async-threads:0] [hipe] [kernel-poll:false]
14:56:16.733 [debug] Lager installed handler lager_console_backend into lager_event
14:56:16.734 [debug] Lager installed handler {lager_file_backend,"log/lager_error.log"} into lager_event
14:56:16.734 [debug] Lager installed handler {lager_file_backend,"log/lager_console.log"} into lager_event
14:56:16.735 [debug] Lager installed handler error_logger_lager_h into error_logger
14:56:16.736 [info] Application lager started on node '[email protected]'
14:56:16.737 [info] Application syntax_tools started on node '[email protected]'
14:56:16.737 [info] Application compiler started on node '[email protected]'
Eshell V5.9.2 (abort with ^G)
([email protected])1> 14:56:16.738 [error] CRASH REPORT Process <0.67.0> with 0 neighbours exited with reason: call to undefined function cowboy:start_listener(ami_ws_dispatcher, 100, cowboy_tcp_transport, [{port,10100}], cowboy_http_protocol, [{dispatch,[{'_',[{'_',erws_handler,[]}]}]}]) in application_master:init/4 line 138
{"Kernel pid terminated",application_controller,"{application_start_failure,erws,{bad_return,{{erws_app,start,[normal,[]]},{'EXIT',{undef,[{cowboy,start_listener,[ami_ws_dispatcher,100,cowboy_tcp_transport,[{port,10100}],cowboy_http_protocol,[{dispatch,[{'_',[{'_',erws_handler,[]}]}]}]],[]},{erws_app,start,2,[{file,[115,114,99,47,101,114,119,115,95,97,112,112,46,101,114,108]},{line,18}]},{application_master,start_it_old,4,[{file,[97,112,112,108,105,99,97,116,105,111,110,95,109,97,115,116,101,114,46,101,114,108]},{line,274}]}]}}}}}"}
Crash dump was written to: erl_crash.dump
Kernel pid terminated (application_controller) ({application_start_failure,erws,{bad_return,{{erws_app,start,[normal,[]]},{'EXIT',{undef,[{cowboy,start_listener,[ami_ws_dispatcher,100,cowboy_tcp_tra
make: *** [runconsole] Error 1
Hope you don't mind a few questions. I put them here so others may find the answers to.
Here's a console grab of a run (sorry so long). My question is why does it start so much stuff? I would only expect it to start one handler? I'm using 127.0.0.1 as my WS address if that matters.
Exec: /Users/a107908/Erlang/erws/rel/erws/erts-5.9.2/bin/erlexec -boot /Users/a107908/Erlang/erws/rel/erws/releases/1/erws -mode embedded -config /Users/a107908/Erlang/erws/rel/erws/releases/1/sys.config -args_file /Users/a107908/Erlang/erws/rel/erws/releases/1/vm.args -- console
Root: /Users/a107908/Erlang/erws/rel/erws
Erlang R15B02 (erts-5.9.2) [source] [64-bit] [smp:4:4] [async-threads:0] [hipe] [kernel-poll:false]
21:52:20.997 [debug] Lager installed handler lager_console_backend into lager_event
21:52:20.998 [debug] Lager installed handler {lager_file_backend,"log/lager_error.log"} into lager_event
21:52:20.998 [debug] Lager installed handler {lager_file_backend,"log/lager_console.log"} into lager_event
21:52:21.000 [debug] Lager installed handler error_logger_lager_h into error_logger
21:52:21.000 [info] Application lager started on node '[email protected]'
21:52:21.000 [debug] Supervisor cowboy_listener_sup started cowboy_listener:start_link(1024, [{dispatch,[{'',[{'',erws_handler,[]}]}]}]) at pid <0.76.0>
21:52:21.001 [debug] Supervisor cowboy_listener_sup started cowboy_requests_sup:start_link() at pid <0.77.0>
21:52:21.001 [debug] Supervisor cowboy_acceptors_sup started cowboy_acceptor:start_link(#Port<0.869>, cowboy_tcp_transport, cowboy_http_protocol, [{dispatch,[{'',[{'',erws_handler,[]}]}]}], <0.76.0>, <0.77.0>) at pid <0.79.0>
21:52:21.002 [debug] Supervisor cowboy_acceptors_sup started cowboy_acceptor:start_link(#Port<0.869>, cowboy_tcp_transport, cowboy_http_protocol, [{dispatch,[{'',[{'',erws_handler,[]}]}]}], <0.76.0>, <0.77.0>) at pid <0.80.0>
21:52:21.003 [debug] Supervisor cowboy_acceptors_sup started cowboy_acceptor:start_link(#Port<0.869>, cowboy_tcp_transport, cowboy_http_protocol, [{dispatch,[{'',[{'',erws_handler,[]}]}]}], <0.76.0>, <0.77.0>) at pid <0.81.0>
21:52:21.003 [debug] Supervisor cowboy_acceptors_sup started cowboy_acceptor:start_link(#Port<0.869>, cowboy_tcp_transport, cowboy_http_protocol, [{dispatch,[{'',[{'',erws_handler,[]}]}]}], <0.76.0>, <0.77.0>) at pid <0.82.0>
21:52:21.003 [debug] Supervisor cowboy_acceptors_sup started cowboy_acceptor:start_link(#Port<0.869>, cowboy_tcp_transport, cowboy_http_protocol, [{dispatch,[{'',[{'',erws_handler,[]}]}]}], <0.76.0>, <0.77.0>) at pid <0.83.0>
Eshell V5.9.2 (abort with ^G)
([email protected])1> 21:52:21.003 [debug] Supervisor cowboy_acceptors_sup started cowboy_acceptor:start_link(#Port<0.869>, cowboy_tcp_transport, cowboy_http_protocol, [{dispatch,[{'',[{'',erws_handler,[]}]}]}], <0.76.0>, <0.77.0>) at pid <0.84.0>
21:52:21.004 [debug] Supervisor cowboy_acceptors_sup started cowboy_acceptor:start_link(#Port<0.869>, cowboy_tcp_transport, cowboy_http_protocol, [{dispatch,[{'',[{'',erws_handler,[]}]}]}], <0.76.0>, <0.77.0>) at pid <0.85.0>
21:52:21.004 [debug] Supervisor cowboy_acceptors_sup started cowboy_acceptor:start_link(#Port<0.869>, cowboy_tcp_transport, cowboy_http_protocol, [{dispatch,[{'',[{'',erws_handler,[]}]}]}], <0.76.0>, <0.77.0>) at pid <0.86.0>
21:52:21.004 [debug] Supervisor cowboy_acceptors_sup started cowboy_acceptor:start_link(#Port<0.869>, cowboy_tcp_transport, cowboy_http_protocol, [{dispatch,[{'',[{'',erws_handler,[]}]}]}], <0.76.0>, <0.77.0>) at pid <0.87.0>
21:52:21.004 [debug] Supervisor cowboy_acceptors_sup started cowboy_acceptor:start_link(#Port<0.869>, cowboy_tcp_transport, cowboy_http_protocol, [{dispatch,[{'',[{'',erws_handler,[]}]}]}], <0.76.0>, <0.77.0>) at pid <0.88.0>
21:52:21.005 [debug] Supervisor cowboy_acceptors_sup started cowboy_acceptor:start_link(#Port<0.869>, cowboy_tcp_transport, cowboy_http_protocol, [{dispatch,[{'',[{'',erws_handler,[]}]}]}], <0.76.0>, <0.77.0>) at pid <0.89.0>
21:52:21.005 [debug] Supervisor cowboy_acceptors_sup started cowboy_acceptor:start_link(#Port<0.869>, cowboy_tcp_transport, cowboy_http_protocol, [{dispatch,[{'',[{'',erws_handler,[]}]}]}], <0.76.0>, <0.77.0>) at pid <0.90.0>
21:52:21.005 [debug] Supervisor cowboy_acceptors_sup started cowboy_acceptor:start_link(#Port<0.869>, cowboy_tcp_transport, cowboy_http_protocol, [{dispatch,[{'',[{'',erws_handler,[]}]}]}], <0.76.0>, <0.77.0>) at pid <0.91.0>
21:52:21.005 [debug] Supervisor cowboy_acceptors_sup started cowboy_acceptor:start_link(#Port<0.869>, cowboy_tcp_transport, cowboy_http_protocol, [{dispatch,[{'',[{'',erws_handler,[]}]}]}], <0.76.0>, <0.77.0>) at pid <0.92.0>
21:52:21.005 [debug] Supervisor cowboy_acceptors_sup started cowboy_acceptor:start_link(#Port<0.869>, cowboy_tcp_transport, cowboy_http_protocol, [{dispatch,[{'',[{'',erws_handler,[]}]}]}], <0.76.0>, <0.77.0>) at pid <0.93.0>
21:52:21.006 [debug] Supervisor cowboy_acceptors_sup started cowboy_acceptor:start_link(#Port<0.869>, cowboy_tcp_transport, cowboy_http_protocol, [{dispatch,[{'',[{'',erws_handler,[]}]}]}], <0.76.0>, <0.77.0>) at pid <0.94.0>
21:52:21.006 [debug] Supervisor cowboy_acceptors_sup started cowboy_acceptor:start_link(#Port<0.869>, cowboy_tcp_transport, cowboy_http_protocol, [{dispatch,[{'',[{'',erws_handler,[]}]}]}], <0.76.0>, <0.77.0>) at pid <0.95.0>
21:52:21.006 [debug] Supervisor cowboy_acceptors_sup started cowboy_acceptor:start_link(#Port<0.869>, cowboy_tcp_transport, cowboy_http_protocol, [{dispatch,[{'',[{'',erws_handler,[]}]}]}], <0.76.0>, <0.77.0>) at pid <0.96.0>
21:52:21.006 [debug] Supervisor cowboy_acceptors_sup started cowboy_acceptor:start_link(#Port<0.869>, cowboy_tcp_transport, cowboy_http_protocol, [{dispatch,[{'',[{'',erws_handler,[]}]}]}], <0.76.0>, <0.77.0>) at pid <0.97.0>
21:52:21.006 [debug] Supervisor cowboy_acceptors_sup started cowboy_acceptor:start_link(#Port<0.869>, cowboy_tcp_transport, cowboy_http_protocol, [{dispatch,[{'',[{'',erws_handler,[]}]}]}], <0.76.0>, <0.77.0>) at pid <0.98.0>
21:52:21.007 [debug] Supervisor cowboy_acceptors_sup started cowboy_acceptor:start_link(#Port<0.869>, cowboy_tcp_transport, cowboy_http_protocol, [{dispatch,[{'',[{'',erws_handler,[]}]}]}], <0.76.0>, <0.77.0>) at pid <0.99.0>
21:52:21.007 [debug] Supervisor cowboy_acceptors_sup started cowboy_acceptor:start_link(#Port<0.869>, cowboy_tcp_transport, cowboy_http_protocol, [{dispatch,[{'',[{'',erws_handler,[]}]}]}], <0.76.0>, <0.77.0>) at pid <0.100.0>
21:52:21.007 [debug] Supervisor cowboy_acceptors_sup started cowboy_acceptor:start_link(#Port<0.869>, cowboy_tcp_transport, cowboy_http_protocol, [{dispatch,[{'',[{'',erws_handler,[]}]}]}], <0.76.0>, <0.77.0>) at pid <0.101.0>
21:52:21.007 [debug] Supervisor cowboy_acceptors_sup started cowboy_acceptor:start_link(#Port<0.869>, cowboy_tcp_transport, cowboy_http_protocol, [{dispatch,[{'',[{'',erws_handler,[]}]}]}], <0.76.0>, <0.77.0>) at pid <0.102.0>
21:52:21.007 [debug] Supervisor cowboy_acceptors_sup started cowboy_acceptor:start_link(#Port<0.869>, cowboy_tcp_transport, cowboy_http_protocol, [{dispatch,[{'',[{'',erws_handler,[]}]}]}], <0.76.0>, <0.77.0>) at pid <0.103.0>
21:52:21.008 [debug] Supervisor cowboy_acceptors_sup started cowboy_acceptor:start_link(#Port<0.869>, cowboy_tcp_transport, cowboy_http_protocol, [{dispatch,[{'',[{'',erws_handler,[]}]}]}], <0.76.0>, <0.77.0>) at pid <0.104.0>
21:52:21.008 [debug] Supervisor cowboy_acceptors_sup started cowboy_acceptor:start_link(#Port<0.869>, cowboy_tcp_transport, cowboy_http_protocol, [{dispatch,[{'',[{'',erws_handler,[]}]}]}], <0.76.0>, <0.77.0>) at pid <0.105.0>
21:52:21.008 [debug] Supervisor cowboy_acceptors_sup started cowboy_acceptor:start_link(#Port<0.869>, cowboy_tcp_transport, cowboy_http_protocol, [{dispatch,[{'',[{'',erws_handler,[]}]}]}], <0.76.0>, <0.77.0>) at pid <0.106.0>
21:52:21.008 [debug] Supervisor cowboy_acceptors_sup started cowboy_acceptor:start_link(#Port<0.869>, cowboy_tcp_transport, cowboy_http_protocol, [{dispatch,[{'',[{'',erws_handler,[]}]}]}], <0.76.0>, <0.77.0>) at pid <0.107.0>
21:52:21.008 [debug] Supervisor cowboy_acceptors_sup started cowboy_acceptor:start_link(#Port<0.869>, cowboy_tcp_transport, cowboy_http_protocol, [{dispatch,[{'',[{'',erws_handler,[]}]}]}], <0.76.0>, <0.77.0>) at pid <0.108.0>
21:52:21.008 [debug] Supervisor cowboy_acceptors_sup started cowboy_acceptor:start_link(#Port<0.869>, cowboy_tcp_transport, cowboy_http_protocol, [{dispatch,[{'',[{'',erws_handler,[]}]}]}], <0.76.0>, <0.77.0>) at pid <0.109.0>
21:52:21.009 [debug] Supervisor cowboy_acceptors_sup started cowboy_acceptor:start_link(#Port<0.869>, cowboy_tcp_transport, cowboy_http_protocol, [{dispatch,[{'',[{'',erws_handler,[]}]}]}], <0.76.0>, <0.77.0>) at pid <0.110.0>
21:52:21.009 [debug] Supervisor cowboy_acceptors_sup started cowboy_acceptor:start_link(#Port<0.869>, cowboy_tcp_transport, cowboy_http_protocol, [{dispatch,[{'',[{'',erws_handler,[]}]}]}], <0.76.0>, <0.77.0>) at pid <0.111.0>
21:52:21.009 [debug] Supervisor cowboy_acceptors_sup started cowboy_acceptor:start_link(#Port<0.869>, cowboy_tcp_transport, cowboy_http_protocol, [{dispatch,[{'',[{'',erws_handler,[]}]}]}], <0.76.0>, <0.77.0>) at pid <0.112.0>
21:52:21.009 [debug] Supervisor cowboy_acceptors_sup started cowboy_acceptor:start_link(#Port<0.869>, cowboy_tcp_transport, cowboy_http_protocol, [{dispatch,[{'',[{'',erws_handler,[]}]}]}], <0.76.0>, <0.77.0>) at pid <0.113.0>
21:52:21.009 [debug] Supervisor cowboy_acceptors_sup started cowboy_acceptor:start_link(#Port<0.869>, cowboy_tcp_transport, cowboy_http_protocol, [{dispatch,[{'',[{'',erws_handler,[]}]}]}], <0.76.0>, <0.77.0>) at pid <0.114.0>
21:52:21.010 [debug] Supervisor cowboy_acceptors_sup started cowboy_acceptor:start_link(#Port<0.869>, cowboy_tcp_transport, cowboy_http_protocol, [{dispatch,[{'',[{'',erws_handler,[]}]}]}], <0.76.0>, <0.77.0>) at pid <0.115.0>
21:52:21.010 [debug] Supervisor cowboy_acceptors_sup started cowboy_acceptor:start_link(#Port<0.869>, cowboy_tcp_transport, cowboy_http_protocol, [{dispatch,[{'',[{'',erws_handler,[]}]}]}], <0.76.0>, <0.77.0>) at pid <0.116.0>
21:52:21.010 [debug] Supervisor cowboy_acceptors_sup started cowboy_acceptor:start_link(#Port<0.869>, cowboy_tcp_transport, cowboy_http_protocol, [{dispatch,[{'',[{'',erws_handler,[]}]}]}], <0.76.0>, <0.77.0>) at pid <0.117.0>
21:52:21.010 [debug] Supervisor cowboy_acceptors_sup started cowboy_acceptor:start_link(#Port<0.869>, cowboy_tcp_transport, cowboy_http_protocol, [{dispatch,[{'',[{'',erws_handler,[]}]}]}], <0.76.0>, <0.77.0>) at pid <0.118.0>
21:52:21.010 [debug] Supervisor cowboy_acceptors_sup started cowboy_acceptor:start_link(#Port<0.869>, cowboy_tcp_transport, cowboy_http_protocol, [{dispatch,[{'',[{'',erws_handler,[]}]}]}], <0.76.0>, <0.77.0>) at pid <0.119.0>
21:52:21.011 [debug] Supervisor cowboy_acceptors_sup started cowboy_acceptor:start_link(#Port<0.869>, cowboy_tcp_transport, cowboy_http_protocol, [{dispatch,[{'',[{'',erws_handler,[]}]}]}], <0.76.0>, <0.77.0>) at pid <0.120.0>
21:52:21.011 [debug] Supervisor cowboy_acceptors_sup started cowboy_acceptor:start_link(#Port<0.869>, cowboy_tcp_transport, cowboy_http_protocol, [{dispatch,[{'',[{'',erws_handler,[]}]}]}], <0.76.0>, <0.77.0>) at pid <0.121.0>
21:52:21.011 [debug] Supervisor cowboy_acceptors_sup started cowboy_acceptor:start_link(#Port<0.869>, cowboy_tcp_transport, cowboy_http_protocol, [{dispatch,[{'',[{'',erws_handler,[]}]}]}], <0.76.0>, <0.77.0>) at pid <0.122.0>
21:52:21.011 [debug] Supervisor cowboy_acceptors_sup started cowboy_acceptor:start_link(#Port<0.869>, cowboy_tcp_transport, cowboy_http_protocol, [{dispatch,[{'',[{'',erws_handler,[]}]}]}], <0.76.0>, <0.77.0>) at pid <0.123.0>
21:52:21.011 [debug] Supervisor cowboy_acceptors_sup started cowboy_acceptor:start_link(#Port<0.869>, cowboy_tcp_transport, cowboy_http_protocol, [{dispatch,[{'',[{'',erws_handler,[]}]}]}], <0.76.0>, <0.77.0>) at pid <0.124.0>
21:52:21.012 [debug] Supervisor cowboy_acceptors_sup started cowboy_acceptor:start_link(#Port<0.869>, cowboy_tcp_transport, cowboy_http_protocol, [{dispatch,[{'',[{'',erws_handler,[]}]}]}], <0.76.0>, <0.77.0>) at pid <0.125.0>
21:52:21.012 [debug] Supervisor cowboy_acceptors_sup started cowboy_acceptor:start_link(#Port<0.869>, cowboy_tcp_transport, cowboy_http_protocol, [{dispatch,[{'',[{'',erws_handler,[]}]}]}], <0.76.0>, <0.77.0>) at pid <0.126.0>
21:52:21.012 [debug] Supervisor cowboy_acceptors_sup started cowboy_acceptor:start_link(#Port<0.869>, cowboy_tcp_transport, cowboy_http_protocol, [{dispatch,[{'',[{'',erws_handler,[]}]}]}], <0.76.0>, <0.77.0>) at pid <0.127.0>
21:52:21.012 [debug] Supervisor cowboy_acceptors_sup started cowboy_acceptor:start_link(#Port<0.869>, cowboy_tcp_transport, cowboy_http_protocol, [{dispatch,[{'',[{'',erws_handler,[]}]}]}], <0.76.0>, <0.77.0>) at pid <0.128.0>
21:52:21.012 [debug] Supervisor cowboy_acceptors_sup started cowboy_acceptor:start_link(#Port<0.869>, cowboy_tcp_transport, cowboy_http_protocol, [{dispatch,[{'',[{'',erws_handler,[]}]}]}], <0.76.0>, <0.77.0>) at pid <0.129.0>
21:52:21.012 [debug] Supervisor cowboy_acceptors_sup started cowboy_acceptor:start_link(#Port<0.869>, cowboy_tcp_transport, cowboy_http_protocol, [{dispatch,[{'',[{'',erws_handler,[]}]}]}], <0.76.0>, <0.77.0>) at pid <0.130.0>
21:52:21.013 [debug] Supervisor cowboy_acceptors_sup started cowboy_acceptor:start_link(#Port<0.869>, cowboy_tcp_transport, cowboy_http_protocol, [{dispatch,[{'',[{'',erws_handler,[]}]}]}], <0.76.0>, <0.77.0>) at pid <0.131.0>
21:52:21.013 [debug] Supervisor cowboy_acceptors_sup started cowboy_acceptor:start_link(#Port<0.869>, cowboy_tcp_transport, cowboy_http_protocol, [{dispatch,[{'',[{'',erws_handler,[]}]}]}], <0.76.0>, <0.77.0>) at pid <0.132.0>
21:52:21.013 [debug] Supervisor cowboy_acceptors_sup started cowboy_acceptor:start_link(#Port<0.869>, cowboy_tcp_transport, cowboy_http_protocol, [{dispatch,[{'',[{'',erws_handler,[]}]}]}], <0.76.0>, <0.77.0>) at pid <0.133.0>
21:52:21.013 [debug] Supervisor cowboy_acceptors_sup started cowboy_acceptor:start_link(#Port<0.869>, cowboy_tcp_transport, cowboy_http_protocol, [{dispatch,[{'',[{'',erws_handler,[]}]}]}], <0.76.0>, <0.77.0>) at pid <0.134.0>
21:52:21.014 [debug] Supervisor cowboy_acceptors_sup started cowboy_acceptor:start_link(#Port<0.869>, cowboy_tcp_transport, cowboy_http_protocol, [{dispatch,[{'',[{'',erws_handler,[]}]}]}], <0.76.0>, <0.77.0>) at pid <0.135.0>
21:52:21.014 [debug] Supervisor cowboy_acceptors_sup started cowboy_acceptor:start_link(#Port<0.869>, cowboy_tcp_transport, cowboy_http_protocol, [{dispatch,[{'',[{'',erws_handler,[]}]}]}], <0.76.0>, <0.77.0>) at pid <0.136.0>
21:52:21.014 [debug] Supervisor cowboy_acceptors_sup started cowboy_acceptor:start_link(#Port<0.869>, cowboy_tcp_transport, cowboy_http_protocol, [{dispatch,[{'',[{'',erws_handler,[]}]}]}], <0.76.0>, <0.77.0>) at pid <0.137.0>
21:52:21.014 [debug] Supervisor cowboy_acceptors_sup started cowboy_acceptor:start_link(#Port<0.869>, cowboy_tcp_transport, cowboy_http_protocol, [{dispatch,[{'',[{'',erws_handler,[]}]}]}], <0.76.0>, <0.77.0>) at pid <0.138.0>
21:52:21.014 [debug] Supervisor cowboy_acceptors_sup started cowboy_acceptor:start_link(#Port<0.869>, cowboy_tcp_transport, cowboy_http_protocol, [{dispatch,[{'',[{'',erws_handler,[]}]}]}], <0.76.0>, <0.77.0>) at pid <0.139.0>
21:52:21.014 [debug] Supervisor cowboy_acceptors_sup started cowboy_acceptor:start_link(#Port<0.869>, cowboy_tcp_transport, cowboy_http_protocol, [{dispatch,[{'',[{'',erws_handler,[]}]}]}], <0.76.0>, <0.77.0>) at pid <0.140.0>
21:52:21.015 [debug] Supervisor cowboy_acceptors_sup started cowboy_acceptor:start_link(#Port<0.869>, cowboy_tcp_transport, cowboy_http_protocol, [{dispatch,[{'',[{'',erws_handler,[]}]}]}], <0.76.0>, <0.77.0>) at pid <0.141.0>
21:52:21.015 [debug] Supervisor cowboy_acceptors_sup started cowboy_acceptor:start_link(#Port<0.869>, cowboy_tcp_transport, cowboy_http_protocol, [{dispatch,[{'',[{'',erws_handler,[]}]}]}], <0.76.0>, <0.77.0>) at pid <0.142.0>
21:52:21.015 [debug] Supervisor cowboy_acceptors_sup started cowboy_acceptor:start_link(#Port<0.869>, cowboy_tcp_transport, cowboy_http_protocol, [{dispatch,[{'',[{'',erws_handler,[]}]}]}], <0.76.0>, <0.77.0>) at pid <0.143.0>
21:52:21.015 [debug] Supervisor cowboy_acceptors_sup started cowboy_acceptor:start_link(#Port<0.869>, cowboy_tcp_transport, cowboy_http_protocol, [{dispatch,[{'',[{'',erws_handler,[]}]}]}], <0.76.0>, <0.77.0>) at pid <0.144.0>
21:52:21.015 [debug] Supervisor cowboy_acceptors_sup started cowboy_acceptor:start_link(#Port<0.869>, cowboy_tcp_transport, cowboy_http_protocol, [{dispatch,[{'',[{'',erws_handler,[]}]}]}], <0.76.0>, <0.77.0>) at pid <0.145.0>
21:52:21.016 [debug] Supervisor cowboy_acceptors_sup started cowboy_acceptor:start_link(#Port<0.869>, cowboy_tcp_transport, cowboy_http_protocol, [{dispatch,[{'',[{'',erws_handler,[]}]}]}], <0.76.0>, <0.77.0>) at pid <0.146.0>
21:52:21.016 [debug] Supervisor cowboy_acceptors_sup started cowboy_acceptor:start_link(#Port<0.869>, cowboy_tcp_transport, cowboy_http_protocol, [{dispatch,[{'',[{'',erws_handler,[]}]}]}], <0.76.0>, <0.77.0>) at pid <0.147.0>
21:52:21.016 [debug] Supervisor cowboy_acceptors_sup started cowboy_acceptor:start_link(#Port<0.869>, cowboy_tcp_transport, cowboy_http_protocol, [{dispatch,[{'',[{'',erws_handler,[]}]}]}], <0.76.0>, <0.77.0>) at pid <0.148.0>
21:52:21.016 [debug] Supervisor cowboy_acceptors_sup started cowboy_acceptor:start_link(#Port<0.869>, cowboy_tcp_transport, cowboy_http_protocol, [{dispatch,[{'',[{'',erws_handler,[]}]}]}], <0.76.0>, <0.77.0>) at pid <0.149.0>
21:52:21.016 [debug] Supervisor cowboy_acceptors_sup started cowboy_acceptor:start_link(#Port<0.869>, cowboy_tcp_transport, cowboy_http_protocol, [{dispatch,[{'',[{'',erws_handler,[]}]}]}], <0.76.0>, <0.77.0>) at pid <0.150.0>
21:52:21.017 [debug] Supervisor cowboy_acceptors_sup started cowboy_acceptor:start_link(#Port<0.869>, cowboy_tcp_transport, cowboy_http_protocol, [{dispatch,[{'',[{'',erws_handler,[]}]}]}], <0.76.0>, <0.77.0>) at pid <0.151.0>
21:52:21.017 [debug] Supervisor cowboy_acceptors_sup started cowboy_acceptor:start_link(#Port<0.869>, cowboy_tcp_transport, cowboy_http_protocol, [{dispatch,[{'',[{'',erws_handler,[]}]}]}], <0.76.0>, <0.77.0>) at pid <0.152.0>
21:52:21.017 [debug] Supervisor cowboy_acceptors_sup started cowboy_acceptor:start_link(#Port<0.869>, cowboy_tcp_transport, cowboy_http_protocol, [{dispatch,[{'',[{'',erws_handler,[]}]}]}], <0.76.0>, <0.77.0>) at pid <0.153.0>
21:52:21.017 [debug] Supervisor cowboy_acceptors_sup started cowboy_acceptor:start_link(#Port<0.869>, cowboy_tcp_transport, cowboy_http_protocol, [{dispatch,[{'',[{'',erws_handler,[]}]}]}], <0.76.0>, <0.77.0>) at pid <0.154.0>
21:52:21.017 [debug] Supervisor cowboy_acceptors_sup started cowboy_acceptor:start_link(#Port<0.869>, cowboy_tcp_transport, cowboy_http_protocol, [{dispatch,[{'',[{'',erws_handler,[]}]}]}], <0.76.0>, <0.77.0>) at pid <0.155.0>
21:52:21.018 [debug] Supervisor cowboy_acceptors_sup started cowboy_acceptor:start_link(#Port<0.869>, cowboy_tcp_transport, cowboy_http_protocol, [{dispatch,[{'',[{'',erws_handler,[]}]}]}], <0.76.0>, <0.77.0>) at pid <0.156.0>
21:52:21.018 [debug] Supervisor cowboy_acceptors_sup started cowboy_acceptor:start_link(#Port<0.869>, cowboy_tcp_transport, cowboy_http_protocol, [{dispatch,[{'',[{'',erws_handler,[]}]}]}], <0.76.0>, <0.77.0>) at pid <0.157.0>
21:52:21.018 [debug] Supervisor cowboy_acceptors_sup started cowboy_acceptor:start_link(#Port<0.869>, cowboy_tcp_transport, cowboy_http_protocol, [{dispatch,[{'',[{'',erws_handler,[]}]}]}], <0.76.0>, <0.77.0>) at pid <0.158.0>
21:52:21.018 [debug] Supervisor cowboy_acceptors_sup started cowboy_acceptor:start_link(#Port<0.869>, cowboy_tcp_transport, cowboy_http_protocol, [{dispatch,[{'',[{'',erws_handler,[]}]}]}], <0.76.0>, <0.77.0>) at pid <0.159.0>
21:52:21.018 [debug] Supervisor cowboy_acceptors_sup started cowboy_acceptor:start_link(#Port<0.869>, cowboy_tcp_transport, cowboy_http_protocol, [{dispatch,[{'',[{'',erws_handler,[]}]}]}], <0.76.0>, <0.77.0>) at pid <0.160.0>
21:52:21.018 [debug] Supervisor cowboy_acceptors_sup started cowboy_acceptor:start_link(#Port<0.869>, cowboy_tcp_transport, cowboy_http_protocol, [{dispatch,[{'',[{'',erws_handler,[]}]}]}], <0.76.0>, <0.77.0>) at pid <0.161.0>
21:52:21.019 [debug] Supervisor cowboy_acceptors_sup started cowboy_acceptor:start_link(#Port<0.869>, cowboy_tcp_transport, cowboy_http_protocol, [{dispatch,[{'',[{'',erws_handler,[]}]}]}], <0.76.0>, <0.77.0>) at pid <0.162.0>
21:52:21.019 [debug] Supervisor cowboy_acceptors_sup started cowboy_acceptor:start_link(#Port<0.869>, cowboy_tcp_transport, cowboy_http_protocol, [{dispatch,[{'',[{'',erws_handler,[]}]}]}], <0.76.0>, <0.77.0>) at pid <0.163.0>
21:52:21.019 [debug] Supervisor cowboy_acceptors_sup started cowboy_acceptor:start_link(#Port<0.869>, cowboy_tcp_transport, cowboy_http_protocol, [{dispatch,[{'',[{'',erws_handler,[]}]}]}], <0.76.0>, <0.77.0>) at pid <0.164.0>
21:52:21.019 [debug] Supervisor cowboy_acceptors_sup started cowboy_acceptor:start_link(#Port<0.869>, cowboy_tcp_transport, cowboy_http_protocol, [{dispatch,[{'',[{'',erws_handler,[]}]}]}], <0.76.0>, <0.77.0>) at pid <0.165.0>
21:52:21.019 [debug] Supervisor cowboy_acceptors_sup started cowboy_acceptor:start_link(#Port<0.869>, cowboy_tcp_transport, cowboy_http_protocol, [{dispatch,[{'',[{'',erws_handler,[]}]}]}], <0.76.0>, <0.77.0>) at pid <0.166.0>
21:52:21.020 [debug] Supervisor cowboy_acceptors_sup started cowboy_acceptor:start_link(#Port<0.869>, cowboy_tcp_transport, cowboy_http_protocol, [{dispatch,[{'',[{'',erws_handler,[]}]}]}], <0.76.0>, <0.77.0>) at pid <0.167.0>
21:52:21.020 [debug] Supervisor cowboy_acceptors_sup started cowboy_acceptor:start_link(#Port<0.869>, cowboy_tcp_transport, cowboy_http_protocol, [{dispatch,[{'',[{'',erws_handler,[]}]}]}], <0.76.0>, <0.77.0>) at pid <0.168.0>
21:52:21.020 [debug] Supervisor cowboy_acceptors_sup started cowboy_acceptor:start_link(#Port<0.869>, cowboy_tcp_transport, cowboy_http_protocol, [{dispatch,[{'',[{'',erws_handler,[]}]}]}], <0.76.0>, <0.77.0>) at pid <0.169.0>
21:52:21.020 [debug] Supervisor cowboy_acceptors_sup started cowboy_acceptor:start_link(#Port<0.869>, cowboy_tcp_transport, cowboy_http_protocol, [{dispatch,[{'',[{'',erws_handler,[]}]}]}], <0.76.0>, <0.77.0>) at pid <0.170.0>
21:52:21.020 [debug] Supervisor cowboy_acceptors_sup started cowboy_acceptor:start_link(#Port<0.869>, cowboy_tcp_transport, cowboy_http_protocol, [{dispatch,[{'',[{'',erws_handler,[]}]}]}], <0.76.0>, <0.77.0>) at pid <0.171.0>
21:52:21.021 [debug] Supervisor cowboy_acceptors_sup started cowboy_acceptor:start_link(#Port<0.869>, cowboy_tcp_transport, cowboy_http_protocol, [{dispatch,[{'',[{'',erws_handler,[]}]}]}], <0.76.0>, <0.77.0>) at pid <0.172.0>
21:52:21.021 [debug] Supervisor cowboy_acceptors_sup started cowboy_acceptor:start_link(#Port<0.869>, cowboy_tcp_transport, cowboy_http_protocol, [{dispatch,[{'',[{'',erws_handler,[]}]}]}], <0.76.0>, <0.77.0>) at pid <0.173.0>
21:52:21.021 [debug] Supervisor cowboy_acceptors_sup started cowboy_acceptor:start_link(#Port<0.869>, cowboy_tcp_transport, cowboy_http_protocol, [{dispatch,[{'',[{'',erws_handler,[]}]}]}], <0.76.0>, <0.77.0>) at pid <0.174.0>
21:52:21.021 [debug] Supervisor cowboy_acceptors_sup started cowboy_acceptor:start_link(#Port<0.869>, cowboy_tcp_transport, cowboy_http_protocol, [{dispatch,[{'',[{'',erws_handler,[]}]}]}], <0.76.0>, <0.77.0>) at pid <0.175.0>
21:52:21.021 [debug] Supervisor cowboy_acceptors_sup started cowboy_acceptor:start_link(#Port<0.869>, cowboy_tcp_transport, cowboy_http_protocol, [{dispatch,[{'',[{'',erws_handler,[]}]}]}], <0.76.0>, <0.77.0>) at pid <0.176.0>
21:52:21.022 [debug] Supervisor cowboy_acceptors_sup started cowboy_acceptor:start_link(#Port<0.869>, cowboy_tcp_transport, cowboy_http_protocol, [{dispatch,[{'',[{'',erws_handler,[]}]}]}], <0.76.0>, <0.77.0>) at pid <0.177.0>
21:52:21.022 [debug] Supervisor cowboy_acceptors_sup started cowboy_acceptor:start_link(#Port<0.869>, cowboy_tcp_transport, cowboy_http_protocol, [{dispatch,[{'',[{'',erws_handler,[]}]}]}], <0.76.0>, <0.77.0>) at pid <0.178.0>
21:52:21.022 [debug] Supervisor cowboy_listener_sup started cowboy_acceptors_sup:start_link(100, cowboy_tcp_transport, [{port,10100}], cowboy_http_protocol, [{dispatch,[{'',[{'',erws_handler,[]}]}]}], <0.76.0>, <0.77.0>) at pid <0.78.0>
21:52:21.022 [debug] Supervisor cowboy_sup started cowboy_listener_sup:start_link(100, cowboy_tcp_transport, [{port,10100}], cowboy_http_protocol, [{dispatch,[{'',[{'',erws_handler,[]}]}]}]) at pid <0.75.0>
21:52:21.022 [info] Application erws started on node '[email protected]'
21:52:30.140 [debug] Request: {http_req,#Port<0.874>,cowboy_tcp_transport,keepalive,<0.184.0>,'GET',{1,1},undefined,[<<"127">>,<<"0">>,<<"0">>,<<"1">>],undefined,<<"127.0.0.1">>,10100,[],undefined,<<"/">>,undefined,<<>>,[],[{<<"Sec-Websocket-Extensions">>,<<"x-webkit-deflate-frame">>},{<<"Sec-Websocket-Version">>,<<"13">>},{<<"Sec-Websocket-Key">>,<<"/3NAqT5RRxt2YpJmCyki7w==">>},{<<"Origin">>,<<"null">>},{'Host',<<"127.0.0.1:10100">>},{'Connection',<<"Upgrade">>},{'Upgrade',<<"websocket">>}],[{'Connection',[<<"upgrade">>]}],undefined,[],waiting,<<>>,waiting,[],<<>>,undefined,{#Fun<cowboy_http.urldecode.2>,crash}}
21:52:30.141 [debug] New client
21:52:38.755 [debug] Got Data: <<"hi!">>
([email protected])1> q().
ok
make all
make run
rel/erws/bin/erws start
Kernel pid terminated (application_controller) ({application_start_failure,cowboy,{bad_return,{{cowboy_app,start,[normal,[]]},{'EXIT',{undef,[{cowboy_app,start,[normal,[]],[]},{application_master,star
Crash dump is being written to: erl_crash.dump...done
A declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.