Skip to content

Instantly share code, notes, and snippets.

@sonlexqt
Created May 30, 2017 10:38
Show Gist options
  • Save sonlexqt/ec344c5683f7792b1ca66e85b3ccf9f3 to your computer and use it in GitHub Desktop.
Save sonlexqt/ec344c5683f7792b1ca66e85b3ccf9f3 to your computer and use it in GitHub Desktop.
import https from 'http';
import socketIO from 'socket.io';
import express from 'express';
const app = express();
const PORT = 9090;
app.get('/', (req, res) => {
console.log('here');
res.send('hello');
});
const server = https.createServer(app);
const io = socketIO(server, {
pingInterval: 2000,
pingTimeout: 5000,
});
io.on('connection', function(socket) {
console.log(`${socket.name} connected`);
});
try {
console.log(`WebRTC signaling server is listening on port ${PORT}`);
server.listen(PORT);
} catch (err) {
console.error('ERROR in webrtc:');
console.error(err);
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment