[99s-extend] Help to use frameset in index.html

Loïc Hoguin essen at ninenines.eu
Tue Jun 23 11:12:56 CEST 2015


I've opened a ticket to remember so something will be done eventually. 
Thanks for helping!

On 06/23/2015 11:11 AM, Graham Hay wrote:
> It's bitten me a few times :(
>
> On 23 June 2015 at 10:09, Loïc Hoguin <essen at ninenines.eu
> <mailto:essen at ninenines.eu>> wrote:
>
>     Oh nice catch ahah. We should probably warn when something like this
>     happens.
>
>     On 06/23/2015 11:06 AM, Graham Hay wrote:
>
>         I think the order of your routes is the problem, try putting
>         this line
>         <https://github.com/ethrbh/websocket_2/blob/master/src/websocket_2_app.erl#L17>
>         last.
>
>         On 23 June 2015 at 09:56, Loïc Hoguin <essen at ninenines.eu
>         <mailto:essen at ninenines.eu>
>         <mailto:essen at ninenines.eu <mailto:essen at ninenines.eu>>> wrote:
>
>              The {error, enoent}, especially there, is probably just
>         because the
>              browser is trying to fetch the favicon.
>
>              Your issue is that Websocket won't connect, so it has
>         nothing to do
>              with cowboy_rest. Try tracing cowboy_websocket or enable
>         SASL to
>              have more info.
>
>
>              On 06/23/2015 10:28 AM, Robert Balogh wrote:
>
>                  hello,
>
>                  First of all I would say I am a beginner in Cowboy web
>         server, so
>                  probably I made something wrong, that is why I got the
>         "fault",
>                  what I got.
>
>                  I would like to build up web page, where the client can
>                  communicate to
>                  server, and server can do the same to client, if client
>         does not
>                  send
>                  anything to server too. The Cowboy has the websocket
>         example,
>                  what does
>                  what I would like to do.
>
>                  There is only one thing is missing what I would like to
>         have.
>                  This is
>                  the "frameset". My idea is to build the index.html
>         using framsets. I
>                  made this changes, and I build up the html files for
>         the frames,
>                  and of
>                  course I set these in the index.html.
>
>                  Here is how the index.html looks like
>                        <html>
>
>                        <head>
>                        <title>Welcome to Websocket example 2</title>
>                        </head>
>
>                        <frameset rows="64,*">
>                            <frame name="top_frame" noresize="noresize"
>         scrolling="no"
>                  src="frame_top.html">
>                            <frameset cols="450,*">
>                                <frame name="left_frame" scrolling="auto"
>                  src="frame_left.html">
>                                <frame name="right_frame"
>         src="frame_right.html">
>                            </frameset>
>                            <noframes>
>                            <body>
>
>                            </body>
>                            </noframes>
>                        </frameset>
>
>                        </html>
>
>                  This is how the priv folder looks like
>                  -----------------------------------------------------------
>                        ls priv/
>                        frame_left.html  frame_right.html  frame_top.html
>                  index.html  static
>
>                  This is how I changed the websocket_2_app:start/2 function
>                  -----------------------------------------------------------
>                        Dispatch = cowboy_router:compile([
>                            {'_', [
>
>                                {"/", cowboy_static, {priv_file, websocket_2,
>                  "index.html"}},
>                                {"/[...]", cowboy_static, {priv_dir,
>         websocket_2,
>                  ""}},
>
>                                {"/websocket_2", ws_handler_2, []},
>                                {"/static/[...]", cowboy_static, {priv_dir,
>                  websocket_2,
>                  "static"}}
>                            ]}
>                        ]),
>
>                  After compile and make release package of the app, I
>         can reach the
>                  webserver on the port 8080, but some connection does
>         not set up
>                  correctly. The following texts are present in the browser
>                        DISCONNECTED
>
>                        ERROR: undefined
>
>                        Connecting to: ws://localhost:8080/websocket_2
>
>                  I made a dbg trace on all cowboy modules, to start some
>         kind of
>                  troubleshooting. In the "tons" of printout I can see
>         this one.
>                  So in the
>                  bottom of this, there is an {error,enoent}. It comes
>         when tries
>                  connect
>                  to the socket. But unfortunatelly I do not have idea
>         what may
>                  cause this :-(
>
>                  The part of trace
>                  -----------------------------------------------------------
>                        (<0.177.0>) call
>
>         cowboy_rest:next({http_req,#Port<0.646>,ranch_tcp,keepalive,<0.177.0>,<<"GET">>,'HTTP/1.1',
>                                  {{127,0,0,1},33241},
>
>         <<"localhost">>,undefined,8080,<<"/websocket_2">>,
>                                  [<<"websocket_2">>],
>                                  <<>>,undefined,[],
>                                  [{<<"host">>,<<"localhost:8080">>},
>                                   {<<"connection">>,<<"Upgrade">>},
>                                   {<<"pragma">>,<<"no-cache">>},
>                                   {<<"cache-control">>,<<"no-cache">>},
>                                   {<<"upgrade">>,<<"websocket">>},
>
>           {<<"origin">>,<<"http://localhost:8080">>},
>                                   {<<"sec-websocket-version">>,<<"13">>},
>                                   {<<"user-agent">>,
>                                    <<"Mozilla/5.0 (X11; Linux i686)
>                  AppleWebKit/537.36
>                  (KHTML, like Gecko) Chrome/40.0.2214.115 Safari/537.36">>},
>                                   {<<"accept-encoding">>,<<"gzip,
>         deflate, sdch">>},
>
>           {<<"accept-language">>,<<"en-US,en;q=0.8">>},
>
>                  {<<"sec-websocket-key">>,<<"by/gwaQvb/51W7Wa9zrGQg==">>},
>                                   {<<"sec-websocket-extensions">>,
>                                    <<"permessage-deflate;
>                  client_max_window_bits">>}],
>                                  [{<<"connection">>,[<<"upgrade">>]}],
>
>
>         undefined,[],waiting,<<>>,undefined,false,waiting,[],<<>>,undefined},{state,[{handler,cowboy_static},
>                                {handler_opts,{priv_dir,websocket_2,[]}},
>                                {listener,http},
>                                {dispatch,[{'_',[],
>                                                [{[],[],cowboy_static,
>
>                    {priv_file,websocket_2,"index.html"}},
>
>                     {['...'],[],cowboy_static,{priv_dir,websocket_2,[]}},
>
>                  {[<<"websocket_2">>],[],ws_handler_2,[]},
>                                                 {[<<"static">>,'...'],
>                                                  [],cowboy_static,
>
>                    {priv_dir,websocket_2,"static"}}]}]}],
>                               <<"GET">>,cowboy_static,
>
>
>         {<<"/home/ethrbh/projects/github/websocket_2/_rel/websocket_2/lib/websocket_2-1/priv/websocket_2">>,
>                                {error,enoent},
>                                []},
>
>
>         undefined,[],undefined,[],undefined,[],undefined,false,undefined,
>
>           undefined,undefined},#Fun<cowboy_rest.2.41839999>)
>                  (Timestamp: {1435,
>
>                       46126,
>
>                       935663})
>
>                  I guess, I did something very wrong, but I did not
>         found what is
>                  that,
>                  thus I would like to get some help from you.
>
>                  Please find my small project in github:
>         https://github.com/ethrbh/websocket_2
>
>                  thanks for your help,
>                  /Robi
>
>
>
>                  _______________________________________________
>                  Extend mailing list
>         Extend at lists.ninenines.eu <mailto:Extend at lists.ninenines.eu>
>         <mailto:Extend at lists.ninenines.eu
>         <mailto:Extend at lists.ninenines.eu>>
>         https://lists.ninenines.eu/listinfo/extend
>
>
>              --
>              Loïc Hoguin
>         http://ninenines.eu
>              Author of The Erlanger Playbook,
>              A book about software development using Erlang
>              _______________________________________________
>              Extend mailing list
>         Extend at lists.ninenines.eu <mailto:Extend at lists.ninenines.eu>
>         <mailto:Extend at lists.ninenines.eu
>         <mailto:Extend at lists.ninenines.eu>>
>         https://lists.ninenines.eu/listinfo/extend
>
>
>
>     --
>     Loïc Hoguin
>     http://ninenines.eu
>     Author of The Erlanger Playbook,
>     A book about software development using Erlang
>
>

-- 
Loïc Hoguin
http://ninenines.eu
Author of The Erlanger Playbook,
A book about software development using Erlang


More information about the Extend mailing list