anchor.diff:  %% business receiver
   %% ===================================================================
   
  -handle_info({m, Data}, #state{socket = Socket} = State) ->
  -    gen_tcp:send(Socket, Data),
  +handle_info({m, Attrs} = Msg, #state{socket = Socket} = State) ->
  +    send_msg_to_client(Msg),
       {noreply, State, State#state.heartbeat_timeout};
  -handle_info({gm, Data}, #state{socket = Socket} = State) ->
  -    gen_tcp:send(Socket, Data),
  +handle_info({gm, Attrs}, #state{socket = Socket} = State) ->
  +    send_msg_to_client(Msg),
       {noreply, State, State#state.heartbeat_timeout};
   handle_info(Info, State) ->
       log:i("Unknown Info: ~p.~n", [Info]),
  
positive.code: 
  handle_info({tcp, Socket, Data}, #state{socket = Socket} = State) ->
      {ok, Toml} = etoml:parse(Data),
      case Toml of
          [{<<"r">>, Attrs}] ->
              {<<"id">>, MsgId} = lists:keyfind(<<"id">>, 1, Attrs),
              log:i("Got r id=~p~n", [MsgId]),
  
              RR = case lists:keyfind(<<"c">>, 1, Attrs) of
                  {<<"c">>, <<"login">>} ->
                      {<<"user">>, UserInfo} = lists:keyfind(<<"user">>, 1, Attrs),
                      {ok, User} = parse_user_info(UserInfo),
                      session_manager:register(User, self()),
                      NewState = State#state{user = User},
                      <<"[rr] id=\"", MsgId/binary, "\" c=\"success\"">>;
                  _ ->
                      NewState = State,
                      <<"[rr] id=\"", MsgId/binary, "\" c=\"error\"">>
              end,
              gen_tcp:send(Socket, RR);
          [{<<"m">>, Attrs}] ->
              send_ack(Socket, Attrs),
  
              case lists:keyfind(<<"to">>, 1, Attrs) of
                  {<<"to">>, ToUserInfo} ->
                      {ok, ToUser} = parse_user_info(ToUserInfo),
                      send_msg_2_single_user(ToUser#user.id, Data);
                  _ ->
                      ignore
              end,
              NewState = State;
          [{<<"gm">>, Attrs}] ->
              send_ack(Socket, Attrs),
  
              case lists:keyfind(<<"group">>, 1, Attrs) of
                  {<<"group">>, [{<<"id">>, GroupId}]} ->
                      % UserIdList = group:get_user_id_list(GroupId),
                      UserIdList = [<<"22">>, <<"23">>],
                      send_msg_2_multiple_users(UserIdList, Data);
                  _ ->
                      ignore
              end,
              NewState = State;
          [{<<"a">>, Attrs}] ->
              % hack:offline
              {<<"id">>, MsgId} = lists:keyfind(<<"id">>, 1, Attrs),
              NewState = State
      end,
      {noreply, NewState, NewState#state.heartbeat_timeout};
  % tcp connection change to passive
  handle_info({tcp_passive, Swocket}, #state{socket = Swocket} = State) ->
  
negative.code: 
  setopts(Swocket) ->
      inet:setopts(Swocket, [{active, 300}, {packet, 0}, binary]).
  
  process_packet([H|T], #state{socket = Socket} = State) ->
      case H of
          {<<"r">>, Attrs} ->
              {<<"id">>, MsgId} = lists:keyfind(<<"id">>, 1, Attrs),
              log:i("Got r id=~p~n", [MsgId]),
  
              RR = case lists:keyfind(<<"c">>, 1, Attrs) of
                  {<<"c">>, <<"login">>} ->
                      {<<"user">>, UserInfo} = lists:keyfind(<<"user">>, 1, Attrs),
                      {ok, User} = parse_user_info(UserInfo),
                      session_manager:register(User, self()),
                      NewState = State#state{user = User},
                      <<"[rr] id=\"", MsgId/binary, "\" c=\"success\"">>;
                  _ ->
                      NewState = State,
                      <<"[rr] id=\"", MsgId/binary, "\" c=\"error\"">>
              end,
              gen_tcp:send(Socket, RR);
          {<<"m">>, Attrs} = Msg ->
              send_ack(Socket, Attrs),
  
              case lists:keyfind(<<"to">>, 1, Attrs) of
                  {<<"to">>, ToUserInfo} ->
                      {ok, ToUser} = parse_user_info(ToUserInfo),
                      send_msg_2_single_user(ToUser#user.id, Msg);
                  _ ->
                      ignore
              end,
              NewState = State;
          {<<"gm">>, Attrs} = Msg ->
              send_ack(Socket, Attrs),
  
              case lists:keyfind(<<"group">>, 1, Attrs) of
                  {<<"group">>, [{<<"id">>, GroupId}]} ->
                      % UserIdList = group:get_user_id_list(GroupId),
                      UserIdList = [<<"22">>, <<"23">>],
                      send_msg_2_multiple_users(UserIdList, Msg);
                  _ ->
                      ignore
              end,
              NewState = State;
          {<<"a">>, Attrs} ->
              % hack:offline
              {<<"id">>, MsgId} = lists:keyfind(<<"id">>, 1, Attrs),
              NewState = State
      end,
      process_toml(T, NewState);
  process_packet([], NewState) ->
      {ok, NewState}.
  
  % [{<<"device">>,<<"android">>},{<<"id">>,<<"1">>}]
  parse_user_info(UserInfo) ->
  