Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

logs every time a user connects to the server

  • Loading branch information...
commit df1a28d5943b6aca4f04daf71882840a2f5128a3 1 parent b361848
@videlalvaro authored
Showing with 8 additions and 0 deletions.
  1. +8 −0 src/rabbitmq_chat_rest.erl
View
8 src/rabbitmq_chat_rest.erl
@@ -64,6 +64,7 @@ handle(_, _, #http_state{req=Req}) ->
%% callback on received websockets data
handle_websocket(#websocket_state{ws=Ws, conn=Conn, exchange=Exchange} = State) ->
+ maybe_log_message(State#websocket_state.chann),
Chann = get_chann(State#websocket_state.chann, Conn),
Consumer = maybe_start_consumer(State#websocket_state.consumer, [Chann, Exchange, self()]),
State2 = State#websocket_state{chann=Chann, consumer=Consumer},
@@ -96,3 +97,10 @@ maybe_start_consumer(undefined, Args) ->
Pid;
maybe_start_consumer(Consumer, _) when is_pid(Consumer) ->
Consumer.
+
+
+maybe_log_message(undefined) ->
+ error_logger:info_msg("User connected~n", []);
+maybe_log_message(_Chann) ->
+ ok.
+
Please sign in to comment.
Something went wrong with that request. Please try again.