<div dir="ltr"><div>Like this....<br><br>{ok, _} =<br>        cowboy:start_http(<br>          http,<br>          100,<br>          [{port, HTTP_Port}],<br>          [{env, [{dispatch, Dispatch}]}]<br>         )<br><br></div>
wes<br></div><div class="gmail_extra"><br><br><div class="gmail_quote">On Thu, Jan 10, 2013 at 7:11 AM, AD <span dir="ltr"><<a href="mailto:straightflush@gmail.com" target="_blank">straightflush@gmail.com</a>></span> wrote:<br>
<blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div dir="ltr">hello,<div><br></div><div>  Using sockjs and the latest cowboy/ranch, I am running into a badarg error with cowboy_router.  Not sure what is causing this, i captured the debug info here in this gist </div>

<div><br></div><div><a href="https://gist.github.com/4502255" target="_blank">https://gist.github.com/4502255</a></div><div><br></div><div>I am starting like this </div><div><br></div><div><pre style="line-height:1.4;font-size:12px;margin-bottom:0px;font-family:Consolas,'Liberation Mono',Courier,monospace;margin-top:0px;word-wrap:break-word;padding:0px">
<div style="padding-top:0px;padding-bottom:0px;padding-left:1em"><span style="color:rgb(0,128,128)">SockjsState</span> <span style="font-weight:bold">=</span> <span style="color:rgb(85,85,85)">sockjs_handler</span><span>:</span><span style="color:rgb(153,0,0);font-weight:bold">init_state</span><span>(</span><span style="font-weight:bold"><<</span><span style="color:rgb(221,17,68)">"/socket"</span><span style="font-weight:bold">>></span><span>,</span><span style="font-weight:bold">fun</span> <span>wsocket_handler</span><span style="font-weight:bold">/</span><span style="color:rgb(0,153,153)">3</span><span>,</span> <span>state</span><span>,</span> <span>[]),</span></div>

</pre><pre style="line-height:1.4;font-size:12px;margin-bottom:0px;font-family:Consolas,'Liberation Mono',Courier,monospace;margin-top:0px;word-wrap:break-word;padding:0px"><div style="padding-top:0px;padding-bottom:0px;padding-left:1em">

<span style="color:rgb(0,128,128)">VRoutes</span> <span style="font-weight:bold">=</span> <span>[{[</span><span style="font-weight:bold"><<</span><span style="color:rgb(221,17,68)">"socket"</span><span style="font-weight:bold">>></span><span>,</span> <span>'...'</span><span>],</span> <span>sockjs_cowboy_handler</span><span>,</span> <span style="color:rgb(0,128,128)">SockjsState</span><span>},</span></div>

</pre><pre style="line-height:1.4;font-size:12px;margin-bottom:0px;font-family:Consolas,'Liberation Mono',Courier,monospace;margin-top:0px;word-wrap:break-word;padding:0px"><div style="padding-top:0px;padding-bottom:0px;padding-left:1em">

                   <span>{</span><span>'_'</span><span>,</span> <span style="font-weight:bold">?</span><span style="color:rgb(0,128,128)">MODULE</span><span>,</span> <span>[]}],</span></div>
<div style="padding-top:0px;padding-bottom:0px;padding-left:1em"><span style="font-size:12px;line-height:1.4"> </span><span style="font-size:12px;line-height:1.4;color:rgb(0,128,128)">Routes</span><span style="font-size:12px;line-height:1.4"> </span><span style="font-size:12px;line-height:1.4;font-weight:bold">=</span><span style="font-size:12px;line-height:1.4"> </span><span style="font-size:12px;line-height:1.4">[{</span><span style="font-size:12px;line-height:1.4">'_'</span><span style="font-size:12px;line-height:1.4">,</span><span style="font-size:12px;line-height:1.4">  </span><span style="font-size:12px;line-height:1.4;color:rgb(0,128,128)">VRoutes</span><span style="font-size:12px;line-height:1.4">}],</span></div>

</pre><pre style="line-height:1.4;font-size:12px;margin-bottom:0px;font-family:Consolas,'Liberation Mono',Courier,monospace;margin-top:0px;word-wrap:break-word;padding:0px"><div style="padding-top:0px;padding-bottom:0px;padding-left:1em">

 <span style="color:rgb(85,85,85)">lager</span><span>:</span><span style="color:rgb(153,0,0);font-weight:bold">info</span><span>(</span><span style="color:rgb(221,17,68)">"Starting the cowboy listener on port </span><span style="color:rgb(221,17,68)">~p</span><span style="color:rgb(221,17,68)">..</span><span style="color:rgb(221,17,68)">~n</span><span style="color:rgb(221,17,68)">"</span><span>,[</span><span style="font-weight:bold">?</span><span style="color:rgb(0,128,128)">COWBOY_HTTP_PORT</span><span>]),</span></div>

</pre><pre style="line-height:1.4;font-size:12px;margin-bottom:0px;font-family:Consolas,'Liberation Mono',Courier,monospace;margin-top:0px;word-wrap:break-word;padding:0px"><div style="padding-top:0px;padding-bottom:0px;padding-left:1em">

 <span style="color:rgb(85,85,85)">cowboy</span><span>:</span><span style="color:rgb(153,0,0);font-weight:bold">start_http</span><span>(</span><span>my_http_listener</span><span>,</span> <span style="font-weight:bold">?</span><span style="color:rgb(0,128,128)">COWBOY_HTTP_ACCEPTORS</span><span>,</span> <span>[{</span><span>port</span><span>,</span> <span style="font-weight:bold">?</span><span style="color:rgb(0,128,128)">COWBOY_HTTP_PORT</span><span>}],</span> <span>[{</span><span>dispatch</span><span>,</span> <span style="color:rgb(0,128,128)">Routes</span><span>}]).</span></div>

<div style="padding-top:0px;padding-bottom:0px;padding-left:1em"><span><br></span></div><div style="padding-top:0px;padding-bottom:0px;padding-left:1em">
<span>But the call to lists:keyfind(dispatch, 1, Env) seems to be failing for some reason.</span></div><div style="padding-top:0px;padding-bottom:0px;padding-left:1em"><span><br>
</span></div><div style="padding-top:0px;padding-bottom:0px;padding-left:1em"><span> Any ideas ?</span></div><div style="padding-top:0px;padding-bottom:0px;padding-left:1em">
<span><br></span></div><div style="padding-top:0px;padding-bottom:0px;padding-left:1em"><span> Thanks</span></div><span class="HOEnZb"><font color="#888888"><div style="padding-top:0px;padding-bottom:0px;padding-left:1em">

<span>- AD</span></div></font></span></pre></div></div>
<br>_______________________________________________<br>
erlang-questions mailing list<br>
<a href="mailto:erlang-questions@erlang.org">erlang-questions@erlang.org</a><br>
<a href="http://erlang.org/mailman/listinfo/erlang-questions" target="_blank">http://erlang.org/mailman/listinfo/erlang-questions</a><br>
<br></blockquote></div><br></div>