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

Marek Majkowski majek04@REDACTED
Mon Aug 13 16:43:14 CEST 2012


Jai,

Here's the answer to your question on SockJS mailing list:

  https://groups.google.com/d/msg/sockjs/m5UtBVcmJ_g/0M92khnAGmgJ

Marek

On Thu, Aug 9, 2012 at 4:23 AM, Jai Gupta <jai@REDACTED> wrote:
> 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
>
> _______________________________________________
> erlang-questions mailing list
> erlang-questions@REDACTED
> http://erlang.org/mailman/listinfo/erlang-questions
>



More information about the erlang-questions mailing list