Giter Club home page Giter Club logo

ezwebframe's People

Contributors

deadzen avatar joearms avatar kimshrier avatar uwiger avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

ezwebframe's Issues

error,{not_started,ssl}

Mac OSX 10.10.5:

../ezwebframe-master$ gmake
...
....
Erlang/OTP 19 [erts-8.2] [source] [64-bit] [smp:4:4] [async-threads:10] [hipe] [kernel-poll:false]

a simple_demo of websockets....
Load the page http://localhost:1456/ in your browser
Starting:{ok,"/Users/7stud/erlang_programs/ezwebframe/ezwebframe-master/demos"}
Eshell V8.2  (abort with ^G)
1> {"init terminating in do_boot",{{badmatch,{error,{not_started,ssl}}},[{ezwebframe,start_link,2,[{file,"src/ezwebframe.erl"},{line,22}]},{init,start_em,1,[]},{init,do_boot,3,[]}]}}
init terminating in do_boot ()

Crash dump is being written to: erl_crash.dump...done
make[1]: *** [all] Error 1
gmake: *** [Makefile:4: all] Error 2

maybe you should update your code?

33 cowboy:start_http(ezwebframe,
34 NumberOfAcceptors,
35 [{port, Port}],
36 [{env, [{dispatch, Dispatch}]}]),
the cowboy not exists this function any more now....

compile error

[root@neptune ezwebframe]# make
==> ezwebframe (get-deps)
Pulling cowboy from {git,"git://github.com/extend/cowboy.git","master"}
Cloning into 'cowboy'...
==> cowboy (get-deps)
Pulling cowlib from {git,"https://github.com/ninenines/cowlib","2.0.1"}
Cloning into 'cowlib'...
Pulling ranch from {git,"https://github.com/ninenines/ranch","1.4.0"}
Cloning into 'ranch'...
==> cowlib (get-deps)
==> ranch (get-deps)
rebar compile
==> cowlib (compile)
/root/ezwebframe/deps/cowlib/src/cow_base64url.erl:31: syntax error before: '{'
/root/ezwebframe/deps/cowlib/src/cow_base64url.erl:40: syntax error before: '{'
/root/ezwebframe/deps/cowlib/src/cow_base64url.erl:52: syntax error before: '{'
/root/ezwebframe/deps/cowlib/src/cow_base64url.erl:59: syntax error before: '{'
/root/ezwebframe/deps/cowlib/src/cow_base64url.erl:21: function decode/1 undefined
/root/ezwebframe/deps/cowlib/src/cow_base64url.erl:22: function decode/2 undefined
/root/ezwebframe/deps/cowlib/src/cow_base64url.erl:23: function encode/1 undefined
/root/ezwebframe/deps/cowlib/src/cow_base64url.erl:55: function encode/3 undefined
/root/ezwebframe/deps/cowlib/src/cow_base64url.erl:54: Warning: missing specification for function encode/2
ERROR: compile failed while processing /root/ezwebframe/deps/cowlib: rebar_abort
make: *** [all] Error 1

clock demo fails: Error during WebSocket handshake

All of the demos fail on my laptop, probably for the same reason. Here's the error that comes up in the console:

WebSocket connection to 'ws://localhost:1456/websocket/clock1' failed: Error during WebSocket handshake: Unexpected response code: 400

This is on Chrome version 40.0.2214.94 (64-bit).

No error comes up on the server side:

ezwebframe:handle "/clocks/clock1.html"
ezwebframe_demos::dispatch /clocks/clock1.html => /Users/issactrotts/erlang/joe_armstrong_book/websockets/ezwebframe/demos/clocks/clock1.html
mapped to:"/Users/issactrotts/erlang/joe_armstrong_book/websockets/ezwebframe/demos/clocks/clock1.html"
ezwebframe:handle "/common/jquery-1.7.1.min.js"
ezwebframe:handle "/ezwebframe/websock.js"
ezwebframe_demos::dispatch /common/jquery-1.7.1.min.js => /Users/issactrotts/erlang/joe_armstrong_book/websockets/ezwebframe/demos/common/jquery-1.7.1.min.js
ezwebframe_demos::dispatch /ezwebframe/websock.js => /Users/issactrotts/erlang/joe_armstrong_book/websockets/ezwebframe/demos/../priv/websock.js
ezwebframe:handle "/clocks/clock1.css"
mapped to:"/Users/issactrotts/erlang/joe_armstrong_book/websockets/ezwebframe/demos/common/jquery-1.7.1.min.js"
mapped to:"/Users/issactrotts/erlang/joe_armstrong_book/websockets/ezwebframe/demos/../priv/websock.js"
ezwebframe_demos::dispatch /clocks/clock1.css => /Users/issactrotts/erlang/joe_armstrong_book/websockets/ezwebframe/demos/clocks/clock1.css
mapped to:"/Users/issactrotts/erlang/joe_armstrong_book/websockets/ezwebframe/demos/clocks/clock1.css"

Quick change request on your demo makefile

I just forked the repo and using rebar I tried to build and run it.

Turns out that there's currently a new dependency on cowboy called cowlib. This means your make file in the demos directory doesn't work with the new cowlib dependency.

One way to fix this is to update line 5 in demos/Makefile to be:

-pa ../deps/*/ebin\

I guess with this change you wont need the "-pa ../deps/cowboy/ebin\ " in line 4.

Thanks

P/S: I'm a great fan. Can't stop reading everything you do

deps/cowboy/src/cowboy_req.erl:1206: illegal use of variable 'Atom' in map

Erlang/OTP 17 [erts-6.4] [source] [64-bit] [async-threads:10] [hipe] [kernel-poll:false]

deps/cowboy/src/cowboy_req.erl:1206: illegal use of variable 'Atom' in map
deps/cowboy/src/cowboy_req.erl:1209: illegal use of variable 'Atom' in map
deps/cowboy/src/cowboy_req.erl:1212: illegal use of variable 'Atom' in map
deps/cowboy/src/cowboy_req.erl:1233: illegal use of variable 'Key' in map
deps/cowboy/src/cowboy_req.erl:1244: illegal use of variable 'Key' in map

Everything goes well under Erlang/OTP 18.

Need better documentation for 'ezwebframe'

I understand the explanations in the book, but am having difficulty understanding the code in ezwebframe.erl. One problem is the seemingly inconsistency between some of the 'cowboy'-related function calls in ezwebframe and documentation found in the cowboy website. For example:

For websockets, Cowboy website says:

   First, the init/3 callback is called. This callback is common to all handlers. To establish a 
   Websocket connection, this function must return an upgrade tuple.

   init(_, Req, Opts) -> {upgrade, protocol, cowboy_websocket}.
        or
   init(_Type, Req, Opts) -> {upgrade, protocol, cowboy_websocket, Req, Opts}.

But in ezwebframe.erl, I see init/2 with a return tuple of {cowboy_websocket, Req, Pid}, which I can't find anywhere in the Cowboy documentation. Is this from an older version of Cowboy? This is just one example. There are others.

I've successfully used the Yaws web server for a couple of projects in the past. Yaws worked well and unlike Cowboy, it is very well documented. I'm taking a look at Cowboy only because Joe used it in his book, which in my opinion, gave it some credibility. Also, I read somewhere that Cowboy is supposed to be a bit lighter weight and has better performance (maybe because of the use single precess per connection and binaries). But I'm struggling with it; the documentation is terrible.

Curious as to why Joe chose Cowboy over Yaws for his book.

"/" ignores dispatch rules

From playing around with this (very cool btw), I noticed that if I attempted to launch my app from a directory other than where index.html resides, "/" would fail to be resolved, whereas if I specified "/index.html" it would be resolved fine.

This appears to be caused due to ezwebframe:handle/2, the logic is different when resolving "/" than any other page. This may be intentional (it makes sense to launch from wherever index.html is located after all), but it is surprising to see -

mapped to:"/location/where/index/is/for/realsies/located"
serve_abs:"index.html"
*** no page called "index.html"

when hitting "/", and have it load just fine when hitting "/index.html".

You also need to start cowlib

Continuing from my previous bug posting a few minutes ago. I also think you need to add application:start(cowlib) in src/ezwebframe.erl.

It's a dependency to cowboy and needs to be running. Suggested update is the line in bold:

...
ok = application:start(crypto),
ok = application:start(ranch),
ok = application:start(cowlib),
ok = application:start(cowboy),
ok = web_server_start(Port, Dispatch).
...

Thanks

John Chukwuma

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.