I have created a simple video chat app using javascript's webRTC library peerjs. And now I am trying to deploy the site on zeit.co. But I get the error when a peerjs instance gets created Below is the code where I have mentioned ports and host to run the server
Server side code
const express = require('express')
const app = express()
const path = require('path')
const server = require('http').createServer(app)
const io = require('socket.io').listen(server)
const srv = server.listen(3000)
app.use('/peerjs', require('peer').ExpressPeerServer(srv, {
debug: true
}))
const users = []
const connections = []
server.listen(3000, () => {
console.log('server running')
})
app.use(express.static(path.join(__dirname, 'public')))
app.get('/', (req, res) => {
})
Client side code
const peerObj = {
host: '127.0.0.1',
path: '/peerjs',
debug: 3,
config: {icerServers: [
{ url: 'stun:stun1.l.google.com:19302' },
{ url: 'turn:numb.viagenie.ca',
credential: 'muazkh',
username: 'webrtc@live.com' }
]}
}
peer = new Peer(peerObj)
- List item