anchor.diff:  init([#connector{connid=Id, app=App,
           publish_uplinks=PubUp, publish_events=PubEv, name=UserName, pass=Password}=Conn]) ->
       ok = pg2:join({backend, App}, self()),
  -    self() ! connect,
       try
  -        {ok, #state{conn=Conn, streams=#{},
  +        {ok, #state{conn=Conn, pid=create_gun(Conn), ready=false, streams=#{},
               publish_uplinks=lorawan_connector:prepare_filling(PubUp),
               publish_events=lorawan_connector:prepare_filling(PubEv),
               auth=lorawan_connector:prepare_filling([UserName, Password]),
  
positive.code:             {stop, shutdown}
      end.
  
  handle_call(_Request, _From, State) ->
      {reply, {error, unknownmsg}, State}.
  
  handle_cast(_Msg, State) ->
      {noreply, State}.
  
  handle_info(connect, #state{conn=Connector}=State) ->
      case connect(Connector) of
          {ok, ConnPid} ->
              {noreply, State#state{pid=ConnPid}};
          {error, _} ->
              % will try to reconnect upon uplink
              {noreply, State#state{pid=undefined}}
      end;
  handle_info(nodes_changed, State) ->
      % nothing to do here
      {noreply, State};
  
negative.code:             do_publish({URI, [User, Pass], ContentType, Body}, [], State)
      end.
  
  do_publish({URI, _Auth, ContentType, Body}=Msg, Headers, State=#state{pid={C,_}, streams=Streams}) ->
      StreamRef = gun:post(C, URI,
          [{<<"content-type">>, ContentType} | Headers], Body),
      State#state{streams=maps:put(StreamRef, Msg, Streams)}.
  