Buttplug Node Websockets
buttplug-node-websockets provides convenience client/server classes
built on top of ws and
buttplug-js. It allows
developers to quickly integrate buttplug clients and servers into
native node applications.
Table Of Contents
Support The Project
If you find this project helpful, you
can
support Buttplugio projects via Patreon!
Every donation helps us afford more hardware to reverse, document, and
write code for!
Installation
To install buttplug-js in your node project via npm, a simple add call
should do it.
npm add buttplug-node-websockets
buttplug-node-websockets is considered a plugin for buttplug-js, and
has buttplug as a peer dependency. You will need to add buttplug-js >=
0.4.0 to the project that is using buttplug-node-websockets in order
for this to work correctly.
API Documentation
buttplug-node-websocket API Documentation is available at
https://buttplug-node-websockets.docs.buttplug.io.
The documentation is rebuilt on every commit/merge to master.
Usage Example
Server
The client class provided with this library derives from the
ButtplugServer class, and can be used as a standalone server.
let Buttplug = require('buttplug');
let ButtplugNodeWebsockets = require('buttplug-node-websockets');
let server = new ButtplugNodeWebsocket.ButtplugNodeWebsocketServer();
server.StartInsecureServer()
server.StartSecureServer("./cert.pem", "./private.pem", 6969, "192.168.1.2");
If you need to create a local secure server with self-signed
certificate (for instance, for accessing the server from a web app on
an https server), we recommend using the
selfsigned package.
Client (Connector)
The client class provided with this library implements the
IButtplugConnector interface, and needs to be passed to a
ButtplugClient class during connection.
let Buttplug = require('buttplug');
let ButtplugNodeWebsockets = require('buttplug-node-websockets');
let connector =
new ButtplugNodeWebsocket.ButtplugNodeWebsocketClientConnector("wss://localhost:12345/buttplug", false);
let bpc = new bp.ButtplugClient("test");
bpc.Connect(connector);
License
buttplug-js is BSD 3-Clause licensed.
Copyright (c) 2017-2018, Nonpolynomial Labs, LLC
All rights reserved.
Redistribution and use in source and binary forms, with or without
modification, are permitted provided that the following conditions are met:
* Redistributions of source code must retain the above copyright notice, this
list of conditions and the following disclaimer.
* Redistributions in binary form must reproduce the above copyright notice,
this list of conditions and the following disclaimer in the documentation
and/or other materials provided with the distribution.
* Neither the name of the project nor the names of its
contributors may be used to endorse or promote products derived
from this software without specific prior written permission.
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE
FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.