Permalink
Browse files

Finally it works with localhost:8080

  • Loading branch information...
1 parent 6a3d247 commit 4b4664986b746ebf8225e5c2e89abd26c42387ef @nisbus committed Nov 1, 2012
Showing with 6 additions and 8 deletions.
  1. +1 −1 ebin/monterl_carlo_websocket.app
  2. +5 −5 src/monterl_carlo_websocket.erl
  3. +0 −2 src/monterl_carlo_websocket_handler.erl
@@ -2,7 +2,7 @@
[{description,[]},
{vsn,"1"},
{registered,[]},
- {modules,[monterl_carlo_static_handler,monterl_carlo_websocket,
+ {modules,[monterl_carlo_websocket,
monterl_carlo_websocket_handler,
monterl_carlo_websocket_sup]},
{applications,[kernel,stdlib,inets,crypto,jsx,cowboy]},
@@ -7,13 +7,13 @@ start(_StartType, _StartArgs) ->
%% Dispatch the requests (whatever the host is) to
%% erws_handler, without any additional options.
Dispatch = [{'_', [
- {[<<"index.htm">>,'...'], cowboy_static,
+ {[<<"index.html">>,'...'], cowboy_static,
[ {directory, {priv_dir, monterl_carlo_websocket,[]}},
- {file,<<"index.htm">>},
- {mimetypes, [{<<".html">>, [<<"text/html">>]}]}]},
- {[<<"flot.jquery.js">>,'...'],cowboy_static,
+ {file,<<"index.html">>},
+ {mimetypes,[{<<".html">>, [<<"text/html">>]}]}]},
+ {[<<"jquery.flot.js">>,'...'],cowboy_static,
[ {directory, {priv_dir, monterl_carlo_websocket,[]}},
- {file,<<"flot.jquery.js">>},
+ {file,<<"jquery.flot.js">>},
{mimetypes, [{<<".js">>, [<<"text/javascript">>]}]}]},
{'_', monterl_carlo_websocket_handler, []}
]}],
@@ -52,7 +52,6 @@ websocket_handle(_Any, Req, State) ->
{ok, Req, State}.
websocket_info({send,Message}, Req, State) ->
- io:format("Sending: ~p~n",[Message]),
{reply, {text, Message}, Req, State};
websocket_info(_Info, Req, State) ->
@@ -62,7 +61,6 @@ websocket_terminate(_Reason, _Req, _State) ->
ok.
handle_message(Msg,Req,#state{callback = Callback} = State) ->
- io:format("Received message ~p~n",[Msg]),
Props = jsx:json_to_term(Msg),
Type = case is_list(Props) of
true -> proplists:get_value(<<"type">>,Props,undefined);

0 comments on commit 4b46649

Please sign in to comment.