 
   @doc false
   @spec terminate(any, t) :: {:noreply, t}
-  def terminate(_reason, %Drab{store: store, session: session, commander: commander} = state) do
+  def terminate(_reason, %Drab{store: store, commander: commander, socket: socket} = state) do
     if commander.__drab__().ondisconnect do
-      # TODO: timeout
-      :ok = apply(commander, commander_config(commander).ondisconnect, [store, session])
+      :ok =
+        apply(commander, commander_config(commander).ondisconnect, [
+          store,
+          socket.assigns[:__session]
+        ])
     end
 
     {:noreply, state}

        }

  defstruct store: %{},
            session: %{},
            commander: nil,
            commanders: [],
            controller: nil,

  end

  # calls for get values from the state
  Enum.each([:store, :socket, :priv, :topics], fn name ->
    msg_name = String.to_atom("get_#{name}")
    @doc false
    def handle_call(unquote(msg_name), _from, state) do
