Created
May 30, 2017 10:38
-
-
Save sonlexqt/ec344c5683f7792b1ca66e85b3ccf9f3 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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