Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

An error happened while running websocket example with latest version of cowboy #62

Closed
gage opened this issue Jan 14, 2013 · 1 comment

Comments

@gage
Copy link

gage commented Jan 14, 2013

I just cloned the code and "make rel" and ran ejabberd in live mode. An error happend when I trying to login the server in the websocket example "simpleclient.html".

[error] emulator Error in process <0.648.0> on node 'ejabberd@localhost' 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,494}]}]}

[error] <0.432.0> Supervisor ranch_conns_sup had child ranch_conns_sup started with {ranch_conns_sup,start_protocol,undefined} at <0.648.0> exit with reason no match of right hand value false in cowboy_router:execute/2 line 37 in context child_terminated

After tracing the code, I think the problem is cowboy has changed the ProtocolOpts settings spec, so I do the following fix, it seems ok now.

--- a/apps/ejabberd/src/mod_websockets.erl
+++ b/apps/ejabberd/src/mod_websockets.erl
@@ -59,7 +59,7 @@ start(_Host, Opts) ->
     NumAcceptors = gen_mod:get_opt(num_acceptors, Opts, 100),
     Port = gen_mod:get_opt(port, Opts, ?DEFAULT_PORT),
     TransportOpts = [{port, Port}],
-    ProtocolOpts = [{dispatch, FullDispatch}],
+    ProtocolOpts = [{env,[{dispatch, FullDispatch}]}],
     cowboy:start_http(?LISTENER, NumAcceptors,
                       TransportOpts, ProtocolOpts).
@erszcz
Copy link
Member

erszcz commented Feb 21, 2013

Solved along with #64.

@erszcz erszcz closed this as completed Feb 21, 2013
pzel pushed a commit that referenced this issue Aug 7, 2015
NelsonVides added a commit that referenced this issue Jul 23, 2021
[FUL-26323] Add ADR for chat markers
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants