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

Expand description

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

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

Structs

[Gateway Intents] will limit the events your bot will receive via the gateway. By default, all intents except Privileged Intents are selected.

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

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

The shard manager monitor monitors the shard manager and performs actions on it as received.

A lightweight wrapper around an mpsc sender.

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

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

Information about a ShardRunner.

Options to be passed to ShardRunner::new.

Enums

A message either for a ShardManager or a ShardRunner.

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

A message to be sent to the ShardQueuer.

A message to send from a shard over a WebSocket.