-
Notifications
You must be signed in to change notification settings - Fork 0
Connection Lifecycle
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.
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.
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.
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.
ButtplugManager will trigger a few events throughout the lifecycle of the connection...
-
OnConnected- called whenButtplugManagerestablishes a connection to the server -
OnDisconnected- called whenButtplugManagercloses its connection to the server, gracefully or otherwise -
OnError(FString& Message)- called when an error is encountered during the connection lifecycle