Skip to content

Instantly share code, notes, and snippets.

@matt-wratt
matt-wratt / webrtc-data-channel-example.js
Created July 26, 2017 12:06
A "simple" example of setting up, connecting, and sending messages over WebRTC
// Please excuse the functional fluff
const tap = fn => v => (fn(v), v)
const log = key => (...args) => console.log(key, ...args)
const pipe = (...fs) => v => fs.reduce((v, fn) => fn(v), v)
const prop = k => v => v[k]
const at = (...ks) => v => ks.reduce((a, b) => prop(b)(a), v)
const error = when => err => console.error(when, err)
const connection = (name) => {
const pc = new RTCPeerConnection({
@matt-wratt
matt-wratt / fiddle.css
Created June 5, 2012 09:18
Testing JS Fiddle
p {
padding: 2px 5px;
}
p span {
color: red;
}