simplewebrtc / SimpleWebRTC

Simplest WebRTC ever
Other
4.64k stars 1.2k forks source link

how chat room user information in the chat room #748

Closed seoksanghwan closed 5 years ago

seoksanghwan commented 5 years ago

You are about to display information (user email) in the chat room. You can use SendDirectlyToAll or SendToAll. This issue occurs only in click events.Is there no other way? (I'm sorry that the sentence is not smooth. I used the translator.)

readyToCall() { const room = this.props.match.params.room_name; //var { email } = this.state; this.webrtc.joinRoom(room); this.webrtc.connection.on('message', function(data){ console.log(data) if(data.type === 'info'){ console.log('chat received',data); console.log(data.payload.nick) } }); }

var { email } = this.props; this.webrtc.sendToAll('info', {nick: email});