• Stars
    star
    645
  • Rank 69,396 (Top 2 %)
  • Language
    JavaScript
  • License
    MIT License
  • Created over 11 years ago
  • Updated over 1 year ago

Reviews

There are no reviews yet. Be the first to send feedback to the community and the maintainers!

Repository Details

An abstraction over P2P video/voice/data connections using WebRTC

DEPRECATED

This module is years old and may not work, use this other one instead!

Example

Server

var holla = require('holla');
var server = http.createServer().listen(8080);
var rtc = holla.createServer(server);

console.log('Server running on port 8080');

Note: Express 3 is no longer a httpServer so you need to do something like:

var server = require('http').createServer(app).listen(8080);

before passing it to holla.createServer

Client

Sending a call:

var rtc = holla.createClient();

rtc.register("tom", function(worked) {
  holla.createFullStream(function(err, stream) {
    var call = rtc.call("bob");
    call.addStream(stream);
  });
});

Receiving a call:

var rtc = holla.createClient();

rtc.register("bob", function(worked) {
  rtc.on("call", function(call) {

    holla.createFullStream(function(err, stream) {
      call.addStream(stream);
      call.answer();
    });

  });
});

Client

holla

.supported

true or false if WebRTC is supported in the browser

.createClient(options)

Takes some options to specify host (see source) - defaults to window.location.href. Returns an RTC instance

.pipe(stream, el)

Pipes a WebRTC video stream to a video element. el can be a string (id), jquery element, or dom node.

.createStream(opt, cb)

Creates a WebRTC stream - opt looks like {video:true,audio:true} depending on the stream you want. cb signature is (err, stream)

createFullStream(cb)

Sugar for .createStream({video:true,audio:true}, cb)

createVideoStream(cb)

Sugar for .createStream({video:true,audio:false}, cb)

createAudioStream(cb)

Sugar for .createStream({video:false,audio:true}, cb)

RTC

.register(name, cb)

Registers your connection with the server under a name. cb receives true or false if it worked. cb is optional.

.call(name)

Creates a call to user with name. Returns a Call instance

.ready(fn)

fn gets called when connection is registered or if it already has been.

Events

RTC will emit connected, authorized, disconnected, error, presence, and call events.

Call

.isCaller

true or false if you started this call.

.user

Name of the user on the other end.

.startTime

Date of the call start.

.endTime

Date of the call end.

.duration()

Duration of the call.

.addStream(stream)

Adds your WebRTC stream to the call. Must be done before answering or sending a call.

.chat(msg)

Sends a chat message

.answer()

Accepts the call (inbound only)

.decline()

Declines the call (inbound only)

.end()

Ends the call (hangup and close connection)

releaseStream()

Release use of the attached stream. Will make a users webcam light go off so they don't think you're spying.

mute()

Mutes the local user's audio to the remote user

unmute()

Unmutes the local user's audio to the remote user

.ready(fn)

Will call fn when the call has been connected and is ready to go or if it is already.

Events

Call will emit calling, connecting, connected, hangup, and chat events

Examples

You can view more examples in the example folder.

Demo

There is a crappy demo up at holla.jit.su

Adapters (complex use cases)

The holla server comes with a default adapter that uses an in-memory store and no auth to manage users. If you would like to override these preference just pass your overrides as the second object to .createServer(httpServer, {adapter: adapterObject}).

An example adapter that uses redis instead of in-memory might look something like this (pseudo-code)

# assume redis is a node-redis connection

adapter =
  register: (req, cb) ->
    client.hset "users", req.name, req.socket.id, cb

  getId: (name, cb) -> 
    client.hget "users", name (err, id) ->
      cb id

  unregister: (req, cb) ->
    client.hdel "users", req.name, cb

  getPresenceTargets: (req, cb) ->
    # these are the people notified on presence changes
    # this assumes contacts.{name} is a list of names you created somewhere else
    client.get "contacts.#{req.name}", (err, contacts) ->
      cb contacts

Changing the name on register

You can set req.name before calling cb to change the name (useful if you send up a cookie in .register then do a lookup for the real name)

Effects

There is effects.css in the repository with some common CSS classes you will want when dealing with RTC video tags (flip, shadow, reflect, fadein, etc.). These are prefixed with rtc (example: .rtc-flip)

LICENSE

(MIT License)

Copyright (c) 2012 Fractal [email protected]

Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:

The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.

More Repositories

1

react-responsive

CSS media queries in react - for responsive design, and more.
TypeScript
6,999
star
2

windows_98.css

some sick styles for your guestbook
CSS
797
star
3

rtc-everywhere

Cross-everything WebRTC mega-project
JavaScript
651
star
4

smog

HTML5/Node/WebSocket MongoDB panel
JavaScript
443
star
5

JMD

Java bytecode analysis/deobfuscation tool
Java
199
star
6

captchagen

Captcha generation for NodeJS
JavaScript
179
star
7

nodecast

Node interface to DIAL/RAMP/ChromeCast
JavaScript
160
star
8

blink-polyfill

Fix idiocy in newer browsers
CSS
152
star
9

bank

simple.com API client
JavaScript
123
star
10

immutable-props

React PropTypes for Immutable.js
JavaScript
96
star
11

wifi-location

Triangulate your WiFi signal to guess geolocation
JavaScript
92
star
12

are-you-a-cop

Blocks cops from visiting your site. If they are they have to tell you.
JavaScript
79
star
13

node-linq

LINQ for node
CoffeeScript
78
star
14

node-gdal-next

Node.js bindings for GDAL (Geospatial Data Abstraction Library) [Fork]
C++
75
star
15

camera

Create readable streams from connected webcams
JavaScript
69
star
16

spotcrime

API client for crime statistics
JavaScript
65
star
17

xmlson

XML/JSON conversion
CoffeeScript
57
star
18

CJBE

Continued Java Bytecode Editor, a tool for modifying and analyzing java bytecode structures and class files
Java
41
star
19

deprecated

Tool for deprecating things
JavaScript
37
star
20

gasp

A declarative layer on top of gulp
JavaScript
37
star
21

sutro

Declarative slightly-opinionated API framework
TypeScript
32
star
22

pinger

Native ICMP ping for node
JavaScript
30
star
23

4chanjs

NodeJS and Browser 4chan API client
JavaScript
30
star
24

TinyShell

A very tiny PHP shell
PHP
27
star
25

glob2base

Extracts a base path from a node-glob instance
JavaScript
26
star
26

dope.travel

Aggregating the coolest shit on earth
25
star
27

jif

Dead simple ternary or if/else replacement
JavaScript
22
star
28

rover

A node.js client for controlling BrookStone Rover 2.0s
JavaScript
22
star
29

net-sim

Simulate network conditions
JavaScript
21
star
30

hymn

React audio player component
JavaScript
20
star
31

faces

Facial recognition
CoffeeScript
19
star
32

JMOT

Java multi-purpose obfuscation utility, a tool for manipulating and obfuscating java bytecode structures. Generates the algorithm that generates the algorithm that will manipulate the code so it is nearly impossible to reverse engineer
Java
19
star
33

try-parse

Try to parse different data types from strings and objects of strings
JavaScript
18
star
34

react-logger

Dead simple logging mixin for react
JavaScript
17
star
35

gifbooth

gif booth for a projector
JavaScript
15
star
36

generate-calendar-url

generate a url to add an event to your calendar
JavaScript
15
star
37

papajohns

Client for the unofficial Papa Johns API
JavaScript
15
star
38

hd.css

Bringing HD Vision Goggles to the web
HTML
14
star
39

PEIK

Properly Engineered Infection Kit, A framework for creating malware in C#. Multi-threaded, comes with a built-in MSIL obfuscator and packer to prevent detection
C#
14
star
40

data-phx

A list of data for scraping/crawling/etc.
13
star
41

thinky-export-schema

Export a schema to a normal object for serialization
JavaScript
12
star
42

native-keyboard

Higher level keyboard binding for node apps
JavaScript
11
star
43

cidr

CIDR IP operations for node
CoffeeScript
10
star
44

djb2

djb2 hash in js
CoffeeScript
9
star
45

drone

Code for messing with an AR drone
JavaScript
9
star
46

instax

API client for controlling the Instax Share SP-1 Polaroid printer
JavaScript
9
star
47

rethinkdb-boundaries

Import US Census TIGER data into RethinkDB as GeoJSON
JavaScript
8
star
48

nextback

Wraps callbacks in async
JavaScript
8
star
49

JBird

Tool for creating undetectable java malware. Comes with a built-in custom obfuscator that uses randomly generated crypto algorithms to prevent detection forever
Java
7
star
50

handle-async

Resolves any function to a value. Generators, callbacks, promises, flat values - don't worry about it!
JavaScript
7
star
51

pretty-metric

Parse, convert, and humanize metric sizes
JavaScript
7
star
52

DotCrack

General .NET/MSIL assembly manipulation/reverse engineering utility
C#
7
star
53

BetterError

A better Error class
JavaScript
7
star
54

vinyl-fs-tree

Create a filesystem tree from vinyl files
JavaScript
7
star
55

msr

JavaScript
6
star
56

soundcloud-lookup

Simply look up info about a URL on soundcloud
JavaScript
6
star
57

sequelize-where

Pure JS implementation of the sequelize query language (where)
JavaScript
6
star
58

rethinkdb-change-stream

Transform rethinkdb change feeds into node streams
JavaScript
5
star
59

BetterRegExp

Utility wrapper over RegExp
CoffeeScript
5
star
60

fotio

Photos
JavaScript
5
star
61

nova

Run NodeJS code in the browser!
JavaScript
5
star
62

revisit

Wrapper around revisit.link spec
JavaScript
5
star
63

node-shodan

Shodan API for node
CoffeeScript
5
star
64

react-swipeable

Swipe right and swipe left with animations
JavaScript
5
star
65

snapchat-blacklist

this is a list of ppl who are evil and screenshot snaps
4
star
66

fixnode

Fixes a bunch of shitty problems
JavaScript
4
star
67

react-flex-lite

Flexbox components for React, as minimal as possible
TypeScript
4
star
68

lobbying

automated lobbying
JavaScript
4
star
69

LOLShell

Remote PHP shell that utilizes new technologies and modern practices
PHP
4
star
70

puzzle-box

Sandboxing with call tracing and more
JavaScript
3
star
71

npm-boilerplate-node

JavaScript
3
star
72

PiFM

Raspberry Pi FM Transmission using NodeJS
C
3
star
73

sleep-schedule

Optimize your sleep
JavaScript
3
star
74

JHook

Overrides standard JVM classes for reverse engineering and debugging purposes
Java
3
star
75

app-config-chain

Cascading configuration for web applications
JavaScript
3
star
76

CooLogger

EXTREMELY OLD - .NET keylogger/malware builder. Steals passwords for most common protocols. Mainly built to test a .NET auth system I was working on
C#
3
star
77

minebot

CoffeeScript
3
star
78

surfer

Surfboard modem restarter
JavaScript
2
star
79

hackery

Hacking utilities for node
CoffeeScript
2
star
80

react-npm-boilerplate

npm module boilerplate
JavaScript
2
star
81

camr

Public facing webcam finder
CoffeeScript
2
star
82

DotNOS

.NET Opcode Sanitizer, a tool that deobfuscates MSIL bytecode by removing invalid opcodes using Mono.cecil
C#
2
star
83

MacFinder

EXTREMELY OLD - Crawls and analyzes craigslist listings to find Macbooks with high resale profit margins
Python
2
star
84

aa-rewards

experiments with the american airlines api
CoffeeScript
2
star
85

boiler

Application boilerplate
JavaScript
2
star
86

npm-geo

Statistics about npm modules by geolocation
JavaScript
2
star
87

gulp-log-emitter

Emit log message objects on node's process object
JavaScript
2
star
88

dev-env

VMWare Developer Image
1
star
89

rethink-decl

Declarative RethinkDB queries
JavaScript
1
star
90

midi

MIDI playground for the raspberry pi
CoffeeScript
1
star
91

az-pollutes

Arizona Pollution site for CodeForPHX
JavaScript
1
star
92

good-stuff

Curated events/places by city
JavaScript
1
star
93

lsd

some webrtc + css filter experiments
JavaScript
1
star
94

embedly-lookup

Simply look up info about a URL on embed.ly
JavaScript
1
star
95

noscope

hitmarkers for the web
JavaScript
1
star
96

framework

MVC framework for NodeJS
JavaScript
1
star
97

syrup

A whitespace-significant Lisp, in CoffeeScript, for funsies.
CoffeeScript
1
star
98

sutro-client

A simple and sugary client for using sutro APIs.
JavaScript
1
star
99

yocontra.github.io

my site
JavaScript
1
star
100

nelson

NodeJS mocking library
CoffeeScript
1
star