<commit_before># webrtc_utils

The *webrtc_utils* package will help you to use WebRTC in your Dart applications. It offers different wrappers and extension points to help you with your application.


The purpose of this package is to hide necessary details from the user's application, thus it will not give you a detailed introduction into WebRTC.

## What is WebRTC

WebRTC is a library supported by Chrome, Opera and Firefox to enable web based Real Time Communication. WebRTC will establish a Peer to Peer (P2P) connection (*RtcPeerConnection*).

## Purpose of webrtc_utils

The webrtc_utils package will help you with two things:

1. Establishing P2P connections between two clients.

2. Establishing P2P connections between multiple clients.

3. Providing a basic signaling server

### DualPeerConnection

The *DualPeerConnection* class will help you with establishing a connection between a pair of peers. This is helpful when you have communication between two parties (e.g. simple desktop sharing or a video conversation).

#### Example

```
import 'dart:html';
import 'package:webrtc_utils/connections.dart';
import 'package:webrtc_utils/signaling.dart';

void main() {
  Map configuration = { "iceServers": [{ "url": "stun:stun.l.google.com:19302" }] };
  SignalingChannel signalingChannel = new WebSocketSignalingChannel("ws://...", new JsonSignalingTransformer());
  DualPeerConnection connection = new DualPeerConnection(configuration, signalingChannel);
  
  (querySelector('#connect') as ButtonElement).onClick.listen((MouseEvent ev) {
    connection.createDataChannel('test');
  });
  
  connection.onMessage.listen((MessageEvent ev) {<commit_msg>Added syntax highlighting to README.md<commit_after># webrtc_utils

The *webrtc_utils* package will help you to use WebRTC in your Dart applications. It offers different wrappers and extension points to help you with your application.


The purpose of this package is to hide necessary details from the user's application, thus it will not give you a detailed introduction into WebRTC.

## What is WebRTC

WebRTC is a library supported by Chrome, Opera and Firefox to enable web based Real Time Communication. WebRTC will establish a Peer to Peer (P2P) connection (*RtcPeerConnection*).

## Purpose of webrtc_utils

The webrtc_utils package will help you with two things:

1. Establishing P2P connections between two clients.

2. Establishing P2P connections between multiple clients.

3. Providing a basic signaling server

### DualPeerConnection

The *DualPeerConnection* class will help you with establishing a connection between a pair of peers. This is helpful when you have communication between two parties (e.g. simple desktop sharing or a video conversation).

#### Example

```dart
import 'dart:html';
import 'package:webrtc_utils/connections.dart';
import 'package:webrtc_utils/signaling.dart';

void main() {
  Map configuration = { "iceServers": [{ "url": "stun:stun.l.google.com:19302" }] };
  SignalingChannel signalingChannel = new WebSocketSignalingChannel("ws://...", new JsonSignalingTransformer());
  DualPeerConnection connection = new DualPeerConnection(configuration, signalingChannel);
  
  (querySelector('#connect') as ButtonElement).onClick.listen((MouseEvent ev) {
    connection.createDataChannel('test');
  });
  
  connection.onMessage.listen((MessageEvent ev) {
{'fraction_non_alphanumeric': 0.08132260947274352, 'fraction_numerical': 0.0065534703604408695, 'mean_word_length': 5.288389513108614, 'pattern_counts': {'":': 4, '<': 3, '<?xml version=': 0, '>': 3, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '3534153', 'n_tokens_mistral': 925, 'n_tokens_neox': 875, 'n_words': 367}