I want to build a multi person chat room based on the browser. I found that WebRTC can realize the connection function, so I chose Peer.js Peer.js on Github
But I can only complete one to one connection.
// Suppose there are three users, this is user_A page
var peer = new Peer(user_A_id)
peer.on('connection', (conn) => {
conn.on('data', (data) => {
console.log(data)
})
})
peer.connect(user_B_id)
peer.connect(user_C_id)
peer.connect(user_..._id)
peer.connect() can only establish a connection with the last one. It cannot connect with everyone. What should I do?