anchor.diff:  
   handle_cast({msg, RawData}, State) ->
     {ok, Struct} = gateway_util:decode(RawData),
  -  Record = gateway_messages:struct_to_record(Struct),
  -  {noreply, case Record of
  -    #send{} ->
  -      send(Record, State);
  -    #join_workerpool{} ->
  -      join_worker_pool(Record, State);
  -    #leave_workerpool{} ->
  -      leave_worker_pool(Record, State);
  -    #join_channel{} ->
  -      join_channel(Record, State);
  -    #get_channel{} ->
  -      get_channel(Record, State);
  -    #leave_channel{} ->
  -      leave_channel(Record, State);
  -    #connect{} ->
  -      connect(Record, State);
  -    #get_ops{} ->
  -      getops(Record, State);
  -    _ ->
  -      gen_server:cast(self(), {error, 221, ["Unrecognized Command"]}),
  -      State
  -  end};
  +  Command = gateway_messages:struct_to_record(Struct),
  +  {noreply, handle_command(Command, State)};
   
   handle_cast({send, Data}, State = #state{outbound_connection = OutboundConnection = #gateway_connection{callback_module = Mod}, api_key = ApiKey}) ->
     case ctl_handler:update_metering(ApiKey) of
  
positive.code: call_callback(CBRef, Args, State) ->
    CBRef2 = gateway_reference:set_method(CBRef, <<"callback">>),
    invoke_rpc(CBRef2, Args, State).
  make_hookchannel_reference(ClientRef) ->
    SessionId = gateway_reference:get_destination_id(ClientRef),
    SystemRef = gateway_reference:client_reference(SessionId, <<"system">>),
  
negative.code:         _     -> verify_secret([null, null])
    end.
  
  initialize_state(ApiKey = false, Id, _, State) ->
    gateway_error:no_valid_api_key(),
    State#state{sessionid = Id};
  