Skip to content

Connection Lifecycle

cind3rdev edited this page Sep 3, 2023 · 1 revision

The ButtplugManager actor component provides functions for connecting to a Buttplug server (such as Intiface Central) and also provides events for various events in the connection lifecycle. Under the hood, ButtplugManager automatically sends an initial handshake to the server and sends a Ping message as often as the server requests to keep the connection alive.

Functions

Connecting

In order to connect to the server, use the Connect function.

By default, ButtplugManager will attempt to connect to a server running at ws://127.0.0.1:12345/ with a client name of "ButtplugUnreal". You can change these values by setting the ServerAddress and ClientName fields on ButtplugManager.

Disconnecting

To disconnect from the server, use the Shutdown function.

The Shutdown function removes the ping timer, stops all connected devices, and then disconnects from the server.

Checking if you're connected

To check if you're currently connected to the server, use the IsConnected() function, which returns true or false depending on if you're actively connected.

Note: You shouldn't attempt to send commands to Buttplug unless IsConnected() returns true, or until the OnConnected event is triggered.

Lifecycle Events

ButtplugManager will trigger a few events throughout the lifecycle of the connection...

  • OnConnected - called when ButtplugManager establishes a connection to the server
  • OnDisconnected - called when ButtplugManager closes its connection to the server, gracefully or otherwise
  • OnError(FString& Message) - called when an error is encountered during the connection lifecycle

Clone this wiki locally