From f6581fac7f21a79750fa492a17d719ba1c5cb832 Mon Sep 17 00:00:00 2001 From: Evan Feenstra Date: Wed, 15 Jul 2020 12:07:13 -0700 Subject: [PATCH] s --- api/utils/socket.ts | 16 ++++++++-------- dist/api/utils/socket.js | 17 ++++++++--------- dist/api/utils/socket.js.map | 2 +- 3 files changed, 17 insertions(+), 18 deletions(-) diff --git a/api/utils/socket.ts b/api/utils/socket.ts index 1645c69..a5413f6 100644 --- a/api/utils/socket.ts +++ b/api/utils/socket.ts @@ -1,11 +1,11 @@ -import * as WebSocket from 'ws' +// import * as WebSocket from 'ws' const socketio = require("socket.io"); let io: any -let srvr: any +// let srvr: any export function connect(server) { - srvr = new WebSocket.Server({ server, clientTracking:true }) + // srvr = new WebSocket.Server({ server, clientTracking:true }) io = socketio(server); io.on('connection', client => { @@ -16,11 +16,11 @@ export function connect(server) { export const send = (body) => { if(io) io.sockets.emit('message',body) - if(srvr){ - srvr.clients.forEach(c=>{ - if(c) c.send(body) - }) - } + // if(srvr){ + // srvr.clients.forEach(c=>{ + // if(c) c.send(body) + // }) + // } } export const sendJson = (object) => { diff --git a/dist/api/utils/socket.js b/dist/api/utils/socket.js index 224b31d..b840318 100644 --- a/dist/api/utils/socket.js +++ b/dist/api/utils/socket.js @@ -1,11 +1,11 @@ "use strict"; Object.defineProperty(exports, "__esModule", { value: true }); -const WebSocket = require("ws"); +// import * as WebSocket from 'ws' const socketio = require("socket.io"); let io; -let srvr; +// let srvr: any function connect(server) { - srvr = new WebSocket.Server({ server, clientTracking: true }); + // srvr = new WebSocket.Server({ server, clientTracking:true }) io = socketio(server); io.on('connection', client => { console.log("=> [socket.io] connected!"); @@ -15,12 +15,11 @@ exports.connect = connect; exports.send = (body) => { if (io) io.sockets.emit('message', body); - if (srvr) { - srvr.clients.forEach(c => { - if (c) - c.send(body); - }); - } + // if(srvr){ + // srvr.clients.forEach(c=>{ + // if(c) c.send(body) + // }) + // } }; exports.sendJson = (object) => { exports.send(JSON.stringify(object)); diff --git a/dist/api/utils/socket.js.map b/dist/api/utils/socket.js.map index b7ad8e24..97655e7 100644 --- a/dist/api/utils/socket.js.map +++ b/dist/api/utils/socket.js.map @@ -1 +1 @@ -{"version":3,"file":"socket.js","sourceRoot":"","sources":["../../../api/utils/socket.ts"],"names":[],"mappings":";;AAAA,gCAA+B;AAC/B,MAAM,QAAQ,GAAG,OAAO,CAAC,WAAW,CAAC,CAAC;AAEtC,IAAI,EAAO,CAAA;AACX,IAAI,IAAS,CAAA;AAEb,SAAgB,OAAO,CAAC,MAAM;IAC5B,IAAI,GAAG,IAAI,SAAS,CAAC,MAAM,CAAC,EAAE,MAAM,EAAE,cAAc,EAAC,IAAI,EAAE,CAAC,CAAA;IAE5D,EAAE,GAAG,QAAQ,CAAC,MAAM,CAAC,CAAC;IACtB,EAAE,CAAC,EAAE,CAAC,YAAY,EAAE,MAAM,CAAC,EAAE;QAC3B,OAAO,CAAC,GAAG,CAAC,2BAA2B,CAAC,CAAA;IAC1C,CAAC,CAAC,CAAC;AACL,CAAC;AAPD,0BAOC;AAEY,QAAA,IAAI,GAAG,CAAC,IAAI,EAAE,EAAE;IAC3B,IAAG,EAAE;QAAE,EAAE,CAAC,OAAO,CAAC,IAAI,CAAC,SAAS,EAAC,IAAI,CAAC,CAAA;IAEtC,IAAG,IAAI,EAAC;QACN,IAAI,CAAC,OAAO,CAAC,OAAO,CAAC,CAAC,CAAA,EAAE;YACtB,IAAG,CAAC;gBAAE,CAAC,CAAC,IAAI,CAAC,IAAI,CAAC,CAAA;QACpB,CAAC,CAAC,CAAA;KACH;AACH,CAAC,CAAA;AAEY,QAAA,QAAQ,GAAG,CAAC,MAAM,EAAE,EAAE;IACjC,YAAI,CAAC,IAAI,CAAC,SAAS,CAAC,MAAM,CAAC,CAAC,CAAA;AAC9B,CAAC,CAAA"} \ No newline at end of file +{"version":3,"file":"socket.js","sourceRoot":"","sources":["../../../api/utils/socket.ts"],"names":[],"mappings":";;AAAA,kCAAkC;AAClC,MAAM,QAAQ,GAAG,OAAO,CAAC,WAAW,CAAC,CAAC;AAEtC,IAAI,EAAO,CAAA;AACX,gBAAgB;AAEhB,SAAgB,OAAO,CAAC,MAAM;IAC5B,+DAA+D;IAE/D,EAAE,GAAG,QAAQ,CAAC,MAAM,CAAC,CAAC;IACtB,EAAE,CAAC,EAAE,CAAC,YAAY,EAAE,MAAM,CAAC,EAAE;QAC3B,OAAO,CAAC,GAAG,CAAC,2BAA2B,CAAC,CAAA;IAC1C,CAAC,CAAC,CAAC;AACL,CAAC;AAPD,0BAOC;AAEY,QAAA,IAAI,GAAG,CAAC,IAAI,EAAE,EAAE;IAC3B,IAAG,EAAE;QAAE,EAAE,CAAC,OAAO,CAAC,IAAI,CAAC,SAAS,EAAC,IAAI,CAAC,CAAA;IAEtC,YAAY;IACZ,8BAA8B;IAC9B,yBAAyB;IACzB,OAAO;IACP,IAAI;AACN,CAAC,CAAA;AAEY,QAAA,QAAQ,GAAG,CAAC,MAAM,EAAE,EAAE;IACjC,YAAI,CAAC,IAAI,CAAC,SAAS,CAAC,MAAM,CAAC,CAAC,CAAA;AAC9B,CAAC,CAAA"} \ No newline at end of file