View Source Phoenix.SessionProcess (phoenix_session_process v0.3.1)

Documentation for Phoenix.SessionProcess.

Add superviser to process tree

[
  ...
  {Phoenix.SessionProcess.Supervisor, []}
]

Add this after the :fetch_session plug to generate a unique session ID.

plug :fetch_session
plug Phoenix.SessionProcess.SessionId

Start a session process with a session ID.

Phoenix.SessionProcess.start("session_id")

This will start a session process using the module defined with

config :phoenix_session_process, session_process: MySessionProcess

Or you can start a session process with a specific module.

Phoenix.SessionProcess.start("session_id", MySessionProcess)
# or
Phoenix.SessionProcess.start("session_id", MySessionProcess, arg)

Check if a session process is started.

Phoenix.SessionProcess.started?("session_id")

Terminate a session process.

Phoenix.SessionProcess.terminate("session_id")

Genserver call on a session process.

Phoenix.SessionProcess.call("session_id", request)

Genserver cast on a session process.

Phoenix.SessionProcess.cast("session_id", request)

List all session processes.

Phoenix.SessionProcess.list_session()

Summary

Functions

Link to this function

call(session_id, request, timeout \\ 15000)

View Source
@spec call(binary(), any(), :infinity | non_neg_integer()) :: any()

See Phoenix.SessionProcess.ProcessSupervisor.call_on_session/3.

Link to this function

cast(session_id, request)

View Source
@spec cast(binary(), any()) :: :ok

See Phoenix.SessionProcess.ProcessSupervisor.cast_on_session/2.

@spec list_session() :: [{binary(), pid()}, ...]
@spec start(binary()) ::
  :ignore | {:error, any()} | {:ok, pid()} | {:ok, pid(), any()}

See Phoenix.SessionProcess.ProcessSupervisor.start_session/1.

Link to this function

start(session_id, module)

View Source
@spec start(binary(), atom()) ::
  :ignore | {:error, any()} | {:ok, pid()} | {:ok, pid(), any()}

See Phoenix.SessionProcess.ProcessSupervisor.start_session/2.

Link to this function

start(session_id, module, arg)

View Source
@spec start(binary(), atom(), any()) ::
  :ignore | {:error, any()} | {:ok, pid()} | {:ok, pid(), any()}

See Phoenix.SessionProcess.ProcessSupervisor.start_session/3.

@spec started?(binary()) :: boolean()

See Phoenix.SessionProcess.ProcessSupervisor.session_process_started?/1.

@spec terminate(binary()) :: :ok | {:error, :not_found}

See Phoenix.SessionProcess.ProcessSupervisor.terminate_session/1.