View Source FastCi.Servers.Websocket.RefState (FastCi v0.1.0)

Agent module which automatically increments the ref value. This is to be used with a pair of websocket servers for unique integers.

Summary

Functions

Returns a specification to start this module under a supervisor.

Get the expected ref value. It will automatically increment inside of an internal agent so the next call will automatically be a unique refid.

Functions

Returns a specification to start this module under a supervisor.

See Supervisor.

@spec ref(pid :: pid()) :: integer()

Get the expected ref value. It will automatically increment inside of an internal agent so the next call will automatically be a unique refid.

Examples

iex> FastCi.Servers.RefState.ref(pid)
1

iex> FastCi.Servers.RefState.ref(pid)
2

iex> FastCi.Servers.RefState.ref(pid)
3