anchor.diff:                          IsSubscribed = contains(Key, Channels),
                           if
                               IsSubscribed ->
  -                               {encode_error(<<"already subscribed">>, Id), State};
  +                                lager:warning("already subscribed ~s/~s~n", [Bucket, Stream]),
  +                                {encode_error(<<"already subscribed">>, Id), State};
   
                               true ->
  +                                lager:info("subscribing ~s/~s~n", [Bucket, Stream]),
                                   Iorio:subscribe(Bucket, Stream, self()),
                                   NewChannels = [Key|Channels],
  -                                io:format("old ~p~nnew ~p~n", [Channels, NewChannels]),
                                   State1 = State#state{channels=NewChannels},
                                   {encode_ok(Id), State1}
                           end
  
positive.code: -record(state, {channels, iorio}).
  
  init(_Transport, Req, Opts, _Active) ->
      io:format("listen init ~p~n", [Opts]),
      {ok, Req, #state{channels=[], iorio=iorio}}.
  
  get_channel_args(Msg) ->
  
negative.code:     end.
  
  info({entry, BucketName, Stream, Entry}, Req, State) ->
      lager:debug("entry received ~s/~s~n", [BucketName, Stream]),
      Json = entry_to_json(Entry, BucketName, Stream),
      JsonBin = jsx:encode(Json),
      {reply, JsonBin, Req, State}.
  
  terminate(_Req, #state{channels=Channels, iorio=Iorio}) ->
      lists:map(fun ({Bucket, Stream}) ->
                        lager:debug("unsubscribing from ~s/~s~n", [Bucket, Stream]),
                        Iorio:unsubscribe(Bucket, Stream, self())
                end, Channels),
      ok.
  