[erlang-questions] Sock.js and Cowboy - Example

Jai Gupta jai@REDACTED
Thu Aug 9 05:23:24 CEST 2012


I am new to both Sock.js and Erlang/Cowboy. I am trying to run a example.

I have already install Erlang on Mac.
$ erl
Erlang R15B01 (erts-5.9.1) [source] [smp:4:4] [async-threads:0] [hipe]
[kernel-poll:false]
Eshell V5.9.1  (abort with ^G)
1>

I am trying to run a simple echo example from my app.

====rebar.config====
%% -*- erlang -*-

{erl_opts, [debug_info]}. %, fail_on_warning]}.

{deps,
  [
    {sockjs, ".*", {git, "git://github.com/sockjs/sockjs-erlang.git",
{branch, "master"}}}
  ]
}.
================

Note that dependency is in following way. My app has dependency on Sockjs
which has dependency on Cowboy which has dependency on Proper.
$ ./rebar get-deps
After above command I get 3 folders in my deps folder. cowboy, proper &
sockjs
$ ./rebar compile

I am getting following error.

$ ./deps/sockjs/examples/cowboy_echo.erl
escript: exception error: undefined function sockjs_handler:init_state/4
  in function  cowboy_echo:main/1 (./deps/sockjs/examples/cowboy_echo.erl,
line 17)
  in call from escript:run/2 (escript.erl, line 727)
  in call from escript:start/1 (escript.erl, line 277)
  in call from init:start_it/1
  in call from init:start_em/1

I have also tried coping cowboy_echo.erl to ./src/ folder but it gives same
error.

Are there any pointers that can help me?

Note: I can successfully run this example if I directly use sockjs-erlang
rebar.config but I want to run it on my app which describes sockjs as
dependency.

Jai
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://erlang.org/pipermail/erlang-questions/attachments/20120809/0732f58f/attachment.htm>


More information about the erlang-questions mailing list