Module buttplug::server

source ·
Expand description

Handles client sessions, as well as discovery and communication with hardware.

The Buttplug Server is just a thin frontend for device connection and communication. The server itself doesn’t do much other than configuring the device system and handling a few non-device related tasks like initial connection handshake and system timeouts. Once a connection is made from a ButtplugClient to a ButtplugServer, the server mostly acts as a pass-thru frontend to the [DeviceManager].

§Server Lifetime

The server has following lifetime stages:

  • Configuration
    • This happens across the ButtplugServerBuilder, as well as the ButtplugServer instance it returns. During this time, we can specify attributes of the server like its name and if it will have a ping timer. It also allows for addition of protocols and device configurations to the system, either via configuration files or through manual API calls.
  • Connection
    • After configuration is done, the server can be put into a listening mode (assuming RemoteServer is being used. for in-process servers, the client own the server and just connects to it directly). At this point, a ButtplugClient can connect and start the handshake process.
  • Pass-thru
    • Once the handshake has succeeded, the server basically becomes a pass-thru to the [DeviceManager], which manages discovery of and communication with devices. The only thing the server instance manages at this point is ownership of the [DeviceManager] and ping timer, but doesn’t really do much itself. The server remains in this state until the connection to the client is severed, at which point all devices connected to the device manager will be stopped.
  • Disconnection
    • The server can be put back in Connection mode without being recreated after disconnection, to listen for another client connection while still maintaining connection to whatever devices the [DeviceManager] has.
  • Destruction
    • If the server object is dropped, all devices are stopped and disconnected as part of the [DeviceManager] teardown.

Modules§

  • Device configuration, connection, and communication

Structs§

Enums§

Type Aliases§