https://github.com/piasy/flutterwebrtcdatachannel
A Flutter plugin allowing apps to use WebRTC DataChannel to establish P2P connection and exchange text messages.
https://github.com/piasy/flutterwebrtcdatachannel
Last synced: 5 months ago
JSON representation
A Flutter plugin allowing apps to use WebRTC DataChannel to establish P2P connection and exchange text messages.
- Host: GitHub
- URL: https://github.com/piasy/flutterwebrtcdatachannel
- Owner: Piasy
- License: mit
- Created: 2018-04-16T00:18:12.000Z (over 7 years ago)
- Default Branch: master
- Last Pushed: 2018-04-16T00:18:51.000Z (over 7 years ago)
- Last Synced: 2025-04-29T21:39:24.375Z (8 months ago)
- Language: Objective-C
- Size: 501 KB
- Stars: 67
- Watchers: 3
- Forks: 13
- Open Issues: 3
-
Metadata Files:
- Readme: README.md
- Changelog: CHANGELOG.md
- License: LICENSE
Awesome Lists containing this project
README
# Flutter WebRTC DataChannel plugin
This plugin allows Flutter apps to use WebRTC DataChannel to establish P2P connection and exchange
text messages.

## Install
Plugin dependency:
``` yaml
webrtc_data_channel: "^0.1.0"
```
WebRTC Android dependency:
``` gradle
rootProject.allprojects {
repositories {
maven {
url "https://google.bintray.com/webrtc"
}
}
}
dependencies {
api 'org.webrtc:google-webrtc:1.0.22672'
}
```
WebRTC iOS dependency:
``` ruby
pod 'GoogleWebRTC', '1.1.22642'
```
## Usage
``` dart
import 'package:webrtc_data_channel/webrtc_data_channel.dart';
// create DataChannel and connect to room
WebRTCDataChannel _dataChannel = new WebRTCDataChannel();
_dataChannel.connect(_roomUrl, _roomId);
// listen for messages
_receivedMessages = _dataChannel.listenMessages()
.listen((String message) {
// handle message
});
// send message
_dataChannel.sendMessage(message);
// disconnect from room
_dataChannel.disconnect();
```
## Server setup
This plugin use [webrtc/apprtc](https://github.com/webrtc/apprtc) as room server and signal server,
you can use `https://appr.tc/` or deploy it yourself, I've a Docker image for it,
[piasy/apprtc-server](https://hub.docker.com/r/piasy/apprtc-server/).
## Development setup
+ `git clone https://github.com/Piasy/webrtc_data_channel`
+ `flutter create -t plugin webrtc_data_channel`
+ `cd webrtc_data_channel/example/ios && pod install`