From 1251f2918c9a99223881ab165068ad3c492b9f75 Mon Sep 17 00:00:00 2001 From: Max Litruv Boonzaayer Date: Fri, 26 Apr 2019 05:44:07 +1000 Subject: [PATCH] stringify message with flatted --- package-lock.json | 5 +++++ package.json | 1 + plugins/wss.js | 5 ++--- 3 files changed, 8 insertions(+), 3 deletions(-) diff --git a/package-lock.json b/package-lock.json index 8d4b634..c113805 100644 --- a/package-lock.json +++ b/package-lock.json @@ -516,6 +516,11 @@ "escape-string-regexp": "^1.0.5" } }, + "flatted": { + "version": "2.0.0", + "resolved": "https://registry.npmjs.org/flatted/-/flatted-2.0.0.tgz", + "integrity": "sha512-R+H8IZclI8AAkSBRQJLVOsxwAoHd6WC40b4QTNWIjzAa6BXOBfQcM587MXDTVPeYaopFNWHUFLx7eNmHDSxMWg==" + }, "fluent-ffmpeg": { "version": "2.1.2", "resolved": "https://registry.npmjs.org/fluent-ffmpeg/-/fluent-ffmpeg-2.1.2.tgz", diff --git a/package.json b/package.json index 5fff010..9e64ed0 100644 --- a/package.json +++ b/package.json @@ -8,6 +8,7 @@ "@google-cloud/vision": "^0.25.0", "colors": "^1.3.3", "discord.js": "^11.4.2", + "flatted": "^2.0.0", "fluent-ffmpeg": "^2.1.2", "inquirer": "^6.2.2", "mysql": "^2.16.0", diff --git a/plugins/wss.js b/plugins/wss.js index 18abcea..8748d24 100644 --- a/plugins/wss.js +++ b/plugins/wss.js @@ -1,8 +1,7 @@ const fs = require('fs'); const https = require('https'); const WebSocket = require('ws'); - - +const { parse, stringify } = require('flatted/cjs'); module.exports = { name: "Websockets Server (8080)", @@ -42,7 +41,7 @@ module.exports = { })) dclient.on('message', (message) => { - ws.send(message.cleanContent) + ws.send(stringify(message)) }) });