[erlang-questions] Programming Erlang: Chap 18, Websockets

Tristan Sloughter t@REDACTED
Sun Jun 25 23:14:40 CEST 2017


The main issue here looks to be that the dep is tied to the master
branch of a git repo. So the dependency is defined as one that will
continually change over time.

The version of ranch used when the code was written probably didn't list
`ssl` as a dependency, now that it does `application:start(ranch)` will
fail. So the quick fix is to add `application:start(asn1),
application:start(public_key), application:start(ssl),` before the start
of ranch. Or just `application:ensure_all_started(ranch)`.

Moral of the story: lock your dependencies (even better if on a package
and not just a git reference) and use a release or
`application:ensure_all_started` for running a project :)

-- 
  Tristan Sloughter
  "I am not a crackpot" - Abe Simpson
  t@REDACTED

On Sun, Jun 25, 2017, at 02:00 PM, Joe Armstrong wrote:
> Unfortunately cowboy (which I used) and the websockets standard have
> changed since I wrote the book. I also used make and not rebar.
> 
> You've now run into what is one of the biggest problems in the
> computer world - code that used to work no longer works despite the
> fact the code itself has not been changed.
> 
> One way around this is to use zero dependencies - in fact several
> programs I wrote 30 years ago in Erlang still work fine with no
> changes because there are no external dependencies. (as an aside: this
> is why I like code with zero external dependencies - it takes a lot
> longer to write - but you don't have to support it into the future
> when they things you depend upon change in a manner that is
> incompatible manner)
> 
> In this example the underlying websockets protocol changed -
> websockets its is a crazy mess - websockets should have provided raw
> socket transport instead they chose to scramble the data in a weird
> manner to avoid problems with badly written proxies.
> 
> The idea of "write once run anywhere" is a great goal - but we can't
> even do this - "write once run forever with no changes to your code"
> would be even better and things like NixOS are a step in the right
> direction.
> 
> Welcome to the world of broken software.
> 
> In my opinion this (making sure software evolution does not break
> existing functioning software)  is one of the biggest remaining
> software problems - my guess is that this problem is getting worse
> (due to the explosion in the numbers of programming languages,
> libraries and frameworks and build systems) and will be even worse in
> the IoT world.
> 
> Lots for you guys to work on :-)
> 
> Cheers
> 
> /Joe
> 
> 
> On Sun, Jun 25, 2017 at 10:02 PM, 7stud <7stud@REDACTED> wrote:
> > I'm having trouble running the demos for the ezwebframe.  I installed the old rebar (v. rebar3), but I'm getting the error:
> >
> >     {badmatch,{error,{not_started,ssl}}
> >
> > I'm on Mac OSX 10.10.5.  Here is my output:
> >
> > ===========
> > ../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
> > ===========
> >
> > Thanks for any help is solving this problem!
> > _______________________________________________
> > erlang-questions mailing list
> > erlang-questions@REDACTED
> > http://erlang.org/mailman/listinfo/erlang-questions
> _______________________________________________
> erlang-questions mailing list
> erlang-questions@REDACTED
> http://erlang.org/mailman/listinfo/erlang-questions



More information about the erlang-questions mailing list