librtcdc

librtcdc is a tiny WebRTC Data Channel implementation that works everywhere.

  • 所有者: xhs/librtcdc
  • 平台:
  • 许可证: Other
  • 分类:
  • 主题:
  • 喜欢:
    0
      比较:

Github星跟踪图

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 demo

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

主要指标

概览
名称与所有者xhs/librtcdc
主编程语言C
编程语言Shell (语言数: 4)
平台
许可证Other
所有者活动
创建于2015-02-01 12:15:18
推送于2018-09-12 11:25:17
最后一次提交2018-09-12 19:24:59
发布数0
用户参与
星数253
关注者数22
派生数40
提交数123
已启用问题?
问题数21
打开的问题数11
拉请求数5
打开的拉请求数3
关闭的拉请求数0
项目设置
已启用Wiki?
已存档?
是复刻?
已锁定?
是镜像?
是私有?