flutter-webrtc / flutter-webrtc-server

A simple WebRTC signaling server for flutter-webrtc.
MIT License
753 stars 304 forks source link

How can I send text between peers ? #50

Closed LucMoreau33560 closed 3 years ago

LucMoreau33560 commented 3 years ago

Hello,

I have two peers on ios and Android. Video and audio work fine using flutter-webrtc-server as signaling server and a TURN server. Now, I want to send data from peer 1 to peer 2. The data is a simple int, sent every second in order to synchronise counters. I try to send data using _socket.send(_encoder.convert(request)); (Signaling.dart), but if the type is not known ("peers", "offer", ...), but the signaling server blocks my message (Unknown type). It would have been a good solution...

Do you have any idea to send simple text message to another peer, or to a room, I don't care if other peers can read the messages !

Thanks, Luc

LucMoreau33560 commented 3 years ago

Hi,

I did it ! I added some code in singaler.go . Very simple : copy the case "candidate" block and paste it just above. Then rename "candidate" into "counter". So now, my signaling server relay the counter message. :-)