简体   繁体   中英

flutter_webrtc : How to send text message to a peer during a visio

In order to establish a visio between 2 peers, I developp an app for iOS and Android. The language is flutter and I use the flutter_webrtc plugin from pub.dev.

Video and audio work fine using flutter-webrtc-server ( https://github.com/flutter-webrtc/flutter-webrtc-server ) as signaling server and another 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", ...), the signaling server blocks my message (I set COUNTER as type) (Unknown type). It would have been a good solution...

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

Thanks, Luc

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. :-)

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM