Browse Source

default socketio config

bugfix/timeout-logging
Evan Feenstra 5 years ago
parent
commit
b254fcfb4f
  1. 13
      api/utils/socket.ts
  2. 13
      dist/api/utils/socket.js
  3. 2
      dist/api/utils/socket.js.map

13
api/utils/socket.ts

@ -3,22 +3,15 @@ const socketio = require("socket.io");
let io: any
function connect(server) {
io = socketio(server, {
// path: '/socket',
serveClient: false,
// below are engine.IO options
pingInterval: 10000,
pingTimeout: 5000,
cookie: false
});
io = socketio(server);
io.on('connection', client => {
console.log("=> [socket.io] connected!")
client.on('event', data => { /* … */ });
client.on('disconnect', () => { /* … */ });
io.sockets.send('{"try":"try"}')
client.send('{"try":"try"}')
// io.sockets.send('{"try":"try"}')
// client.send('{"try":"try"}')
});
}

13
dist/api/utils/socket.js

@ -3,20 +3,13 @@ Object.defineProperty(exports, "__esModule", { value: true });
const socketio = require("socket.io");
let io;
function connect(server) {
io = socketio(server, {
// path: '/socket',
serveClient: false,
// below are engine.IO options
pingInterval: 10000,
pingTimeout: 5000,
cookie: false
});
io = socketio(server);
io.on('connection', client => {
console.log("=> [socket.io] connected!");
client.on('event', data => { });
client.on('disconnect', () => { });
io.sockets.send('{"try":"try"}');
client.send('{"try":"try"}');
// io.sockets.send('{"try":"try"}')
// client.send('{"try":"try"}')
});
}
exports.connect = connect;

2
dist/api/utils/socket.js.map

@ -1 +1 @@
{"version":3,"file":"socket.js","sourceRoot":"","sources":["../../../api/utils/socket.ts"],"names":[],"mappings":";;AAAA,MAAM,QAAQ,GAAG,OAAO,CAAC,WAAW,CAAC,CAAC;AAEtC,IAAI,EAAO,CAAA;AAEX,SAAS,OAAO,CAAC,MAAM;IACrB,EAAE,GAAG,QAAQ,CAAC,MAAM,EAAE;QACpB,mBAAmB;QACnB,WAAW,EAAE,KAAK;QAClB,8BAA8B;QAC9B,YAAY,EAAE,KAAK;QACnB,WAAW,EAAE,IAAI;QACjB,MAAM,EAAE,KAAK;KACd,CAAC,CAAC;IAEH,EAAE,CAAC,EAAE,CAAC,YA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