[99s-extend] Problems with Bullet

Phillips, Christopher Christopher.Phillips at turner.com
Mon Apr 8 16:11:44 CEST 2013


  Can you get the clock example working? I'm not sure why the initial
upgrade request would fail; are you exporting init/4 in your handler? Are
your dependencies consistent (I.e., blow them away and regrab them in case
it's an older version of cowboy with a new version of bullet, or vice
versa, maybe)? Either way, starting from the example would allow you to
start from a set of working code and either avoid the issue entirely, or
isolate it from your code.

On 4/8/13 9:53 AM, "Lee Sylvester" <lee.sylvester at gmail.com> wrote:

>Hi all,
>
>I'm currently having problems getting a websocket to connect to a simple
>bare bones Bullet handler.  Unfortunately, I'm still quite an Erlang
>noob, so the stack traces tend to lead me in circles.  I'm hoping this is
>obvious stuff to you Erlang pros :-)
>
>Given the below handler:
>
>init(_Transport, Req, _Opts, _Active) ->
>	{ok, Req, undefined_state}.
>
>stream(Data, Req, State) ->
>	{ok, Req, State}.
>
>info(Info, Req, State) ->
>	{reply, Info, Req, State}.
>	
>terminate(_Req, _State) ->
>	ok.
>
>Connecting with a websocket throws the following error:
>
>=ERROR REPORT==== 8-Apr-2013::14:46:11 ===
>** Cowboy handler bullet_handler terminating in init/3
>   for the reason error:undef
>** Options were [{handler,connection_handler}]
>** Request was [{socket,#Port<0.926>},
>                {transport,ranch_tcp},
>                {connection,keepalive},
>                {pid,<0.491.0>},
>                {method,<<"GET">>},
>                {version,{1,1}},
>                {peer,{{127,0,0,1},56630}},
>                {host,<<"localhost">>},
>                {host_info,undefined},
>                {port,8080},
>                {path,<<"/">>},
>                {path_info,undefined},
>                {qs,<<"encoding=text">>},
>                {qs_vals,undefined},
>                {fragment,<<>>},
>                {bindings,[]},
>                {headers,[{<<"upgrade">>,<<"websocket">>},
>                          {<<"connection">>,<<"Upgrade">>},
>                          {<<"host">>,<<"localhost:8080">>},
>                          {<<"origin">>,<<"http://www.websocket.org">>},
>                          {<<"pragma">>,<<"no-cache">>},
>                          {<<"cache-control">>,<<"no-cache">>},
>                          {<<"sec-websocket-key">>,
>                           <<"fEj/SOOcQgSKATOjhbNJBQ==">>},
>                          {<<"sec-websocket-version">>,<<"13">>},
>                          {<<"sec-websocket-extensions">>,
>                           <<"x-webkit-deflate-frame">>}]},
>                {p_headers,[{<<"connection">>,[<<"upgrade">>]}]},
>                {cookies,undefined},
>                {meta,[]},
>                {body_state,waiting},
>                {multipart,undefined},
>                {buffer,<<>>},
>                {resp_compress,false},
>                {resp_state,waiting},
>                {resp_headers,[]},
>                {resp_body,<<>>},
>                {onresponse,undefined}]
>** Stacktrace: [{bullet_handler,init,
>                    [{tcp,http},
>                     {http_req,#Port<0.926>,ranch_tcp,keepalive,<0.491.0>,
>                         <<"GET">>,
>                         {1,1},
>                         {{127,0,0,1},56630},
>                         <<"localhost">>,undefined,8080,<<"/">>,
>                         undefined,<<"encoding=text">>,undefined,<<>>,
>                         [],
>                         [{<<"upgrade">>,<<"websocket">>},
>                          {<<"connection">>,<<"Upgrade">>},
>                          {<<"host">>,<<"localhost:8080">>},
>                          {<<"origin">>,<<"http://www.websocket.org">>},
>                          {<<"pragma">>,<<"no-cache">>},
>                          {<<"cache-control">>,<<"no-cache">>},
>                          {<<"sec-websocket-key">>,
>                           <<"fEj/SOOcQgSKATOjhbNJBQ==">>},
>                          {<<"sec-websocket-version">>,<<"13">>},
>                          {<<"sec-websocket-extensions">>,
>                           <<"x-webkit-deflate-frame">>}],
>                         [{<<"connection">>,[<<"upgrade">>]}],
>                  
>undefined,[],waiting,undefined,<<>>,false,waiting,[],
>                         <<>>,undefined},
>                     [{handler,connection_handler}]],
>                    []},
>                {cowboy_handler,handler_init,4,
>                    [{file,"src/cowboy_handler.erl"},{line,69}]},
>                {cowboy_protocol,execute,4,
>                    [{file,"src/cowboy_protocol.erl"},{line,514}]}]
>
>Can anyone see what might be throwing this off?  I'd like to get a
>minimal handler running before I attempt to add some logic.
>
>Thanks,
>Lee
>_______________________________________________
>Extend mailing list
>Extend at lists.ninenines.eu
>http://lists.ninenines.eu:81/listinfo/extend
>





More information about the Extend mailing list