Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
-module(websocket_app).
-behaviour(application).
-export([start/2]).
-export([stop/1]).
-export([public_router/0]).
public_router() ->
PublicDispatch = cowboy_router:compile (
[{'_', [
{"/", cowboy_static, {file, "/root/client/index.html"}},
{"/info.html", cowboy_static, {file, "/root/client/info.html"}},
{"/out/[...]", cowboy_static, {dir, "/root/client/resources/release/out/"}},
{"/websocket", ws_handler, []},
{"/static/[...]", cowboy_static, {priv_dir, websocket, "static"}}]}]),
{ok, _} = cowboy:start_http(http, 100, [{port, 8080}],
[{env, [{dispatch, PublicDispatch}]}]).
start(_Type, _Args) ->
spawn(websocket_app, public_router),
% PrivateDispatch = cowboy_router:compile (
% [{'_', [
% {"/", cowboy_static, {file, "/root/client/index.html"}},
% {"/info.html", cowboy_static, {file, "/root/client/info.html"}},
% {"/out/[...]", cowboy_static, {dir, "/root/client/resources/dev/out/"}},
% {"/websocket", ws_handler, []},
% {"/static/[...]", cowboy_static, {priv_dir, websocket, "static"}}]}]),
% {ok, _} = cowboy:start_http(http, 100, [{port, 7070}],
% [{env, [{dispatch, PrivateDispatch}]}]),
websocket_sup:start_link().
stop(_State) ->
ok.
@txrev319

This comment has been minimized.

Copy link
Owner Author

@txrev319 txrev319 commented Mar 9, 2014

start(_Type, _Args) ->
public_router(),

(but changing ig to this works)

@txrev319

This comment has been minimized.

Copy link
Owner Author

@txrev319 txrev319 commented Mar 9, 2014

Erlang/OTP 17 [RELEASE CANDIDATE 2] [erts-6.0] [source] [64-bit] [async-threads:10] [hipe] [kernel-poll:false]

=INFO REPORT==== 9-Mar-2014::03:33:06 ===
application: websocket
exited: {bad_return,
{{websocket_app,start,[normal,[]]},
{'EXIT',
{badarg,
[{erlang,spawn,[public_router],[]},
{websocket_app,start,2,
[{file,"src/websocket_app.erl"},{line,24}]},
{application_master,start_it_old,4,
[{file,"application_master.erl"},
{line,272}]}]}}}}
type: permanent
Eshell V6.0 (abort with ^G)
(websocket_example@127.0.0.1)1> {"Kernel pid terminated",application_controller,"{application_start_failure,websocket,{bad_return,{{websocket_app,start,[normal,[]]},{'EXIT',{badarg,[{erlang,spawn,[public_router],[]},{websocket_app,start,2,[{file,"src/websocket_app.erl"},{line,24}]},{application_master,start_it_old,4,[{file,"application_master.erl"},{line,272}]}]}}}}}"}

Crash dump was written to: erl_crash.dump
Kernel pid terminated (application_controller) ({application_start_failure,websocket,{bad_return,{{websocket_app,start,[normal,[]]},{'EXIT',{badarg,[{erlang,spawn,[public_router],[]},{websocket_app,

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment