buttplug-hs-core- Client library for buttplug.io
Copyright(c) James Sully 2020-2021
LicenseBSD 3-Clause
Safe HaskellNone



Provides methods of connecting to a Buttplug Server



class Connector c where Source #

Abstracts over methods of connecting to a buttplug server. The connector contains all the information necessary for establishing a connection.

Associated Types

type Connection c = conn | conn -> c Source #

A Connector determines a unique connection type that is used for communication.


runClient :: c -> (Connection c -> IO a) -> IO a Source #

Main entry point for communicating with the Buttplug server. Establish a connection to the server and pass the connection handle to the continuation.

sendMessages :: Connection c -> [Message] -> IO () Source #

Send Messages to the server. In the Buttplug protocol, all messages are wrapped in a JSON array (here a Haskell list) to facilitate sending multiple messages simultaneously. Use sendMessage to send a single message.

receiveMsgs :: Connection c -> IO [Message] Source #

receive Messages from the server

sendMessage :: forall c. Connector c => Connection c -> Message -> IO () Source #

Send the server a single Message

data ConnectorException Source #

An exception type abstracting over the exceptions that might arise in the course of communication with the buttplug server. Connector instances in general should throw these rather than Exceptions specific to the connection type.

handleWSConnFailed :: HandshakeException -> IO a Source #

Convert HandshakeException into ConnectionFailed

handleSockConnFailed :: IOError -> IO a Source #

Convert socket connection issues into ConnectionFailed

handleWSConnException :: ConnectionException -> IO a Source #

Convert websocket specific connection exceptions into ConnectorException