View Source Teiserver.Connections (Teiserver v0.0.4)
The context for all things connection related, mostly Teiserver.Connections.Client
Clients
Clients are represented by a process
holding their state, this process controls all updates to their state.
Creating a client
Clients are created using connect_user/1
, this will create (if it doesn't already exist) a client process. Any process connecting a user will be subscribed to the Teiserver.ClientUpdates:{user_id}
channel.
Destroying clients
When a client loses all connections it will begin a countdown (which can be configured). If a connection is re-established in that time the countdown will be reset. If the countdown reaches zero then the client process will be stopped and the client will no longer show up on any lists.
Summary
Clients
@spec connect_user(Teiserver.user_id()) :: Teiserver.Connections.Client.t()
@spec disconnect_user(Teiserver.user_id()) :: :ok
@spec get_client(Teiserver.user_id()) :: Teiserver.Connections.Client.t() | nil
@spec get_client_list([Teiserver.user_id()]) :: [ Teiserver.Connections.Client.t() | nil ]
@spec list_client_ids() :: [Teiserver.user_id()]
@spec list_local_client_ids() :: [Teiserver.user_id()]
See Teiserver.Connections.ClientLib.list_local_client_ids/0
.
@spec subscribe_to_client( Teiserver.Account.User.id() | Teiserver.Account.User.t() | Teiserver.Connections.Client.t() ) :: :ok
@spec unsubscribe_from_client( Teiserver.Account.User.id() | Teiserver.Account.User.t() | Teiserver.Connections.Client.t() ) :: :ok
See Teiserver.Connections.ClientLib.unsubscribe_from_client/1
.
@spec update_client(Teiserver.user_id(), map(), String.t()) :: Teiserver.Connections.Client.t() | nil
@spec update_client_full(Teiserver.user_id(), map(), String.t()) :: Teiserver.Connections.Client.t() | nil
@spec update_client_in_lobby(Teiserver.user_id(), map(), String.t()) :: Teiserver.Connections.Client.t() | nil
See Teiserver.Connections.ClientLib.update_client_in_lobby/3
.