Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
client.on("message", async (message) => {
const msg = FromJSON(message);
for (const m of msg) {
const outgoing = await bs.SendMessage(m);
// Make sure our message is packed in an array, as the buttplug spec
// requires.
client.send("[" + outgoing.toJSON() + "]");
}
});
private ParseIncomingMessage = (aMsg: WebSocket.Data) => {
if (typeof (aMsg) === "string") {
const msgs = FromJSON(aMsg);
const emitMsgs = this._sorter.ParseIncomingMessages(msgs);
this.emit("message", emitMsgs);
} else {
throw new ButtplugMessageException("Unknown message transfer type");
}
}