WebRTC for Go
Switch branches/tags
Nothing to show
Clone or download
David Fifield and arlolra Regen linux magic with -D_GLIBCXX_USE_CXX11_ABI=0.
In order to do this, I had to hack
	defines += [ "_GLIBCXX_USE_CXX11_ABI=0" ]
into build/config/BUILD.gn.
Latest commit a1272c0 Apr 3, 2018
Permalink
Failed to load latest commit information.
demo Functional options for CreateDataChannel Oct 12, 2017
include Update include/ for branch-heads/64 Apr 3, 2018
lib Regen linux magic with -D_GLIBCXX_USE_CXX11_ABI=0. Apr 3, 2018
.gitattributes try .gitattributes Dec 8, 2015
.gitignore Update include/ for branch-heads/64 Apr 3, 2018
.travis.yml Bump go version in macOS builds on travis for runtime complaint Mar 5, 2018
CONTRIBUTING.md Move conventions to a CONTRIBUTING.md Dec 31, 2015
LICENSE add LICENSE. (closes #25) Jan 2, 2016
README.md Update to branch-heads/64. Apr 3, 2018
build.sh Update to branch-heads/64. Apr 3, 2018
configuration.go Appease go fmt / vet Mar 5, 2018
configuration_test.go go fmt Feb 15, 2016
ctestenums.cc Update to branch-heads/64. Apr 3, 2018
ctestenums.h expose Go IceConnectionState enums which correspond to native enums u… Jan 9, 2016
datachannel.cc Add function SendText to DataChannel Mar 25, 2017
datachannel.go Explicit frees Mar 1, 2018
datachannel.h Add function SendText to DataChannel Mar 25, 2017
datachannel.hpp Update to branch-heads/64. Apr 3, 2018
datachannel_test.go Add function SendText to DataChannel Mar 25, 2017
ice.go Don't export enum string slices. Mar 11, 2017
ice_test.go Split up test a bit Feb 15, 2016
logging.go Appease vet Mar 9, 2016
peerconnection.cc Update to branch-heads/64. Apr 3, 2018
peerconnection.go Appease go fmt / vet Mar 5, 2018
peerconnection.h Explicit frees Mar 1, 2018
peerconnection_test.go Explicit frees Mar 1, 2018
sdp.go Fix a leak Feb 23, 2016
sdp_test.go go fmt Feb 15, 2016
utils.go Add a string conversion for a variety of enums Nov 14, 2016
utils_test.go include CGOMap in tests (#41) Jun 15, 2016
webrtc-darwin-amd64.pc Add definition for macOS build Apr 3, 2018
webrtc-linux-386.pc Add speculative definition to Linux to match macOS Apr 3, 2018
webrtc-linux-amd64.pc Add speculative definition to Linux to match macOS Apr 3, 2018
webrtc-linux-arm.pc Add speculative definition to Linux to match macOS Apr 3, 2018

README.md

go-webrtc

Build Status

WebRTC for Golang.

Current Status:

This repository is currently fluctuating a lot, and the exposed interfaces will change. Do not rely on anything in here yet!

  • A PeerConnection can be successfully established between two separate machines using this Go library.
  • It is possible to exchange bytes over a real DTLS/SCTP datachannel. (See the chat demo)
  • Video/Audio support from the Media API is not implemented as it's low priority for us -- but pull requests will be gladly taken!

There is still lots of work to do!

Usage

To immediately see some action, try the chat demo from two machines (or one...)

  • git clone https://github.com/keroserene/go-webrtc
  • cd go-webrtc
  • go run demo/chat/chat.go

Type "start" in one of the Peers, and copy the session descriptions. (This is the "copy-paste" signalling channel). If ICE negotiation succeeds, a really janky chat session should begin.

To write Go code which requires WebRTC functionality:

import "github.com/keroserene/go-webrtc/"

And then you can do things like webrtc.NewPeerConnection(...).

If you've never used WebRTC before, there is already plenty of information online along with javascript examples, but for the Go code here, take a look within demo/* for real usage examples which show how to prepare a PeerConnection and set up the necessary callbacks and signaling.

Also, here are the GoDocs.

Dependencies:

  • GCC 5+
  • TODO:

Package naming

The package name is webrtc, even though the repo name is go-webrtc. (This may be slightly contrary to Go convention, unless we consider the suffix to really begin at the last dash. Reasons:

  • Dashes aren't allowed in package names
  • Including the word "go" in a Go package name seems redundant
  • Just calling this repo webrtc wouldn't make sense either.
  • Also you can rename imported packages to whatever you like.

(e.g. import "foo" "github.com/keroserene/go-webrtc")

Building

Latest tested native webrtc archive: 88f5d9180eae78a6162cccd78850ff416eb82483

There are currently two ways to build gowebrtc: the easy way, and the hard way.

The hard way is to build from scratch, which involves Google's depot_tools and chromium stuff, gclient syncing, which takes a couple hours, and possibly many more if you run into problems... along with writing a custom ninja file and concatenating archives correctly and such.

See webrtc.org native-code dev.

The easy way is to use the pre-built archive I've provided in lib/.

Once the archive is ready, cgo takes care of everything, and building is as easy as go build or go install.

TODO(keroserene): More information / provide a real build script to automate the hard way so it becomes the easy way. (See Issue #23)