Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/xhs/librtcdc
Tiny portable WebRTC Data Channel in C.
https://github.com/xhs/librtcdc
Last synced: 16 days ago
JSON representation
Tiny portable WebRTC Data Channel in C.
- Host: GitHub
- URL: https://github.com/xhs/librtcdc
- Owner: xhs
- License: other
- Created: 2015-02-01T12:15:18.000Z (almost 10 years ago)
- Default Branch: master
- Last Pushed: 2018-09-12T11:25:17.000Z (about 6 years ago)
- Last Synced: 2024-07-31T22:55:19.661Z (3 months ago)
- Language: C
- Homepage:
- Size: 122 KB
- Stars: 247
- Watchers: 24
- Forks: 39
- Open Issues: 14
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
## librtcdc is a tiny WebRTC DataChannel implementation that works everywhere (Beta).
**BEING REWRITEN**
#### Features
* Tiny <2k LOC, easy to understand/bind/extend
* Talks with each other, latest Chrome/Chromium, Firefox, Opera?, Safari?
* 'Official' Python binding
* Lack of docs#### Prerequisites
* Python & Cython (only for Python binding)
* ICE - [libnice](http://nice.freedesktop.org/wiki/) (>= 0.1.8)
* DTLS - [OpenSSL](https://www.openssl.org/)
* SCTP - [usrsctp](https://github.com/sctplab/usrsctp)#### Python demo
```python
import pyrtcdc
from pyrtcdc import PeerConnection# called when the channel received a message
def on_message(channel, datatype, data):
print 'received data from channel %s: %s' %(channel.label, data)
channel.send(pyrtcdc.DATATYPE_STRING, 'Roger')# called when a channel is created by the remote peer
def on_channel(peer, channel):
print 'channel %s created' %(channel.label)
channel.on_message = on_message# called when a new local candidate is found
def on_candidate(peer, candidate):
print 'local candidate sdp:\n%s' %(candidate)# called when connected to remote peer
def on_connect(peer):
peer.create_data_channel('demo', on_open=on_open)# called when channel is opened
def on_open(channel):
channel.on_message = on_message
channel.send(pyrtcdc.DATATYPE_STRING, 'Hi')peer = PeerConnection(on_channel, on_candidate, stun_server='stun.services.mozilla.com')
# generate local offer sdp and start candidates gathering
offer = peer.generate_offer()# offer/answer/candidates signalling here (or somewhere)
# ...# running until the sun cools
peer.loop()
```#### License
BSD 2-Clause