Open darkyen opened 8 years ago
You can achieve this by letting the peers you want to connect together join in a room and then exchange signalling data by calling p2pserver()
on the server:
const server = require('http').createServer()
const p2pserver = require('socket.io-p2p-server').Server
const io = require('socket.io')(server)
server.listen(3030)
io.on('connection', socket => {
socket.join(room) /* Join the room */
p2pserver(socket, null, room) /* All sockets in the specified room will attempt to establish a WebRTC connection. */
})
I think with socket.io it should be rather simple to do this by allowing a peer to connect to remote peers selectively.Maybe In a discovery based method ? This would give more control to the developer, additionally authentication of peers can than be handled serverside (allows enforcing rules).
and on the other hand (or maybe filter this in server)