Skip to content

Instantly share code, notes, and snippets.

@denen99
Created January 10, 2013 14:09
Show Gist options
  • Save denen99/4502255 to your computer and use it in GitHub Desktop.
Save denen99/4502255 to your computer and use it in GitHub Desktop.
SockjsState = sockjs_handler:init_state(<<"/socket">>,fun wsocket_handler/3, state, []),
VRoutes = [{[<<"socket">>, '...'], sockjs_cowboy_handler, SockjsState},
{'_', ?MODULE, []}],
Routes = [{'_', VRoutes}],
lager:info("Starting the cowboy listener on port ~p..~n",[?COWBOY_HTTP_PORT]),
cowboy:start_http(my_http_listener, ?COWBOY_HTTP_ACCEPTORS, [{port, ?COWBOY_HTTP_PORT}], [{dispatch, Routes}]).
Protoopts is [{dispatch,
[{'_',
[{[<<"socket">>,'...'],
sockjs_cowboy_handler,
{service,"/socket",
#Fun<example_sockjs_handler.0.96838682>,
[{callback,example_callback}],
"https://d1fxtkz8shb9d2.cloudfront.net/sockjs-0.3.min.js",
false,true,5000,25000,131072,
#Fun<sockjs_handler.0.32204701>}},
{'_',example_sockjs_handler,[]}]}]}]
2013-01-10 08:35:43.762 [debug] <0.729.0> Supervisor ranch_sup started ranch_listener_sup:start_link(my_http_listener, 100, ranch_tcp, [{port,9093}], cowboy_protocol, [{dispatch,[{'_',[{[<<"socket">>,'...'],sockjs_cowboy_handler,{service,"/socket",#Fun<example_so..>,...}},...]}]}]) at pid <0.781.0>
2013-01-10 08:35:54.672 [error] emulator Error in process <0.989.0> on node 'example@127.0.0.1' with exit value: {{badmatch,false},[{cowboy_router,execute,2,[{file,"src/cowboy_router.erl"},{line,37}]},{cowboy_protocol,execute,4,[{file,"src/cowboy_protocol.erl"},{line,467}]}]}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment