[][src]Module serenity::client::bridge::gateway

The client gateway bridge is support essential for the client module.

This is made available for user use if one wishes to be lower-level or avoid the higher functionality of the Client.

Of interest are three pieces:

ShardManager

The shard manager is responsible for being a clean interface between the user and the shard runners, providing essential functions such as ShardManager::shutdown to shutdown a shard and ShardManager::restart to restart a shard.

If you are using the Client, this is likely the only piece of interest to you. Refer to its documentation for more information.

ShardQueuer

The shard queuer is a light wrapper around an mpsc receiver that receives ShardManagerMessages. It should be run in its own thread so it can receive messages to start shards in a queue.

Refer to its documentation for more information.

ShardRunner

The shard runner is responsible for actually running a shard and communicating with its respective WebSocket client.

It is performs all actions such as sending a presence update over the client and, with the help of the Shard, will be able to determine what to do. This is, for example, whether to reconnect, resume, or identify with the gateway.

In Conclusion

For almost every - if not every - use case, you only need to possibly be concerned about the ShardManager in this module.

Modules

event

A collection of events created by the client, not a part of the Discord API itself.

Structs

ShardId

A light tuplestruct wrapper around a u64 to verify type correctness when working with the IDs of shards.

ShardManager

A manager for handling the status of shards by starting them, restarting them, and stopping them when required.

ShardManagerMonitor

The shard manager monitor does what it says on the tin -- it monitors the shard manager and performs actions on it as received.

ShardManagerOptions
ShardMessenger

A lightweight wrapper around an mpsc sender.

ShardQueuer

The shard queuer is a simple loop that runs indefinitely to manage the startup of shards.

ShardRunner

A runner for managing a Shard and its respective WebSocket client.

ShardRunnerInfo

Information about a ShardRunner.

ShardRunnerOptions

Options to be passed to ShardRunner::new.

Enums

ShardClientMessage

A message either for a ShardManager or a ShardRunner.

ShardManagerMessage

A message for a ShardManager relating to an operation with a shard.

ShardQueuerMessage

A message to be sent to the ShardQueuer.

ShardRunnerMessage

A message to send from a shard over a WebSocket.