Code Monkey home page Code Monkey logo

flutterwebrtcdatachannel's Introduction

Flutter WebRTC DataChannel plugin

This plugin allows Flutter apps to use WebRTC DataChannel to establish P2P connection and exchange text messages.

Install

Plugin dependency:

webrtc_data_channel: "^0.1.0"

WebRTC Android dependency:

rootProject.allprojects {
    repositories {
        maven {
            url  "https://google.bintray.com/webrtc"
        }
    }
}

dependencies {
    api 'org.webrtc:google-webrtc:1.0.22672'
}

WebRTC iOS dependency:

pod 'GoogleWebRTC', '1.1.22642'

Usage

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

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

flutterwebrtcdatachannel's People

Contributors

piasy avatar

Watchers

 avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.