PS2.ESS.Conn (PlanetSide 2 API v1.0.0)
View SourceSummary
Functions
Returns the current subscription of the given ESS connection
Handles websocket messages. The process that called new/1,2 will receive
messages that should be passed to this function for processing.
Resends the subscription message down the websocket, assuming at least one subscription was sent previously. Useful in cases where ESS may mysteriously stop sending events of a certain kind. Alternatively, consider killing the connection altogether for a fresh start.
Sends a new subscription message down the socket. Since subscriptions are
additive, the given %PS2.ESS.Subscription{} will add to subscriptions of
any previous calls to this function. If the given subscription sets
clear?: true, it will remove the specified items from your total
subscription set.
Types
@type event() :: map()
@type send_subscription_result() :: {:ok, t()} | {:error, t(), :conn_not_upgraded | Mint.WebSocket.error() | any()}
@opaque t()
Functions
@spec current_subscription(t()) :: PS2.ESS.Subscription.t() | nil
Returns the current subscription of the given ESS connection
@spec handle_message(t(), message :: term()) :: {:connected, t()} | {:ok, t(), [event()]} | {:error, t(), Mint.WebSocket.error() | :unexpected_upgrade_response}
Handles websocket messages. The process that called new/1,2 will receive
messages that should be passed to this function for processing.
@spec send_subscription(t()) :: send_subscription_result() | {:error, t(), :no_subscription_given}
Resends the subscription message down the websocket, assuming at least one subscription was sent previously. Useful in cases where ESS may mysteriously stop sending events of a certain kind. Alternatively, consider killing the connection altogether for a fresh start.
Since subscriptions are additive, if more than one subscription message was sent earlier, the cumulative set of subscription will be resent.
@spec send_subscription(t(), PS2.ESS.Subscription.t()) :: {:ok, t()} | {:error, t(), :conn_not_upgraded | Mint.WebSocket.error() | any()}
Sends a new subscription message down the socket. Since subscriptions are
additive, the given %PS2.ESS.Subscription{} will add to subscriptions of
any previous calls to this function. If the given subscription sets
clear?: true, it will remove the specified items from your total
subscription set.