• Stars
    star
    285
  • Rank 145,115 (Top 3 %)
  • Language
    JavaScript
  • License
    MIT License
  • Created about 15 years ago
  • Updated almost 13 years ago

Reviews

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

Repository Details

HookBox is a Comet server and message queue that tightly integrates with your existing web application via web hooks and a REST interface.
= HookBox Notes =

Hookbox is a comet server and message queue that tightly integrates with web application frameworks. The goal of Hookbox is to allow your web application (php, django, rails, etc.) to handle all of the logic pertaining to authentication, authorization, logging, message transformation, etc, while still hiding the hard parts of Comet.

== Hookbox HTTP Api ==

=== /publish ===

Request

    URL: [HOOKBOX]/publish

Request Form:
    channel_name: The destination to publish the message
    payload: (default null) The payload for the message

Responses
    true: It worked
    false: Some error occurred

=== /channel_info ===

Request

    URL: [HOOKBOX]/channel_info

Request Form:
    channel_name: The destination to publish the message
    payload: (default null) The payload for the message

Response:
    true: It worked
    false: Some error occurred

Response Data
    channel_name (string): The name of the channel
    subscribers (list): List of channel subscribers
    reflective (bool): Does this channel reflect publishes to publisher
    history (int): Length of history kept in the channel

=== /set_channel_options ===

Request

    URL: [HOOKBOX]/set_channel_options

Request Form:
    channel_name: The name of the channel to modify with the given options.
    reflective: (bool, default=true)
    history_size: (int, default=0) Determines the size of the history kept per channel. This history is sent to users when they subscribe to a channel.
    moderated: (bool, default=true) If true, then all events on the channel must be authorized via a callback.
    moderated_publish: (bool, default=true) If true, publish events must be authorized via a callback.
    moderated_subscribe: (bool, default=true) If true, subscribe events must be authorized via a callback.
    moderated_unsubscribe: (bool, default=true) If true, unsubscribe events must be authorized via a callback.
    presenceful: (bool, default=false) If true, presence lists will be attached to each publish frame. Also, SUBSCRIBED and UNSUBSCRIBED frames will be sent to all channel subscribers when another user subscribes or unsubscribes.
    anonymous: (bool, default=false) If true, usernames will be omitted from publish frames
Response:
    true: It worked
    false: Some error occurred

Response Data
    None

== HookBox Webhooks ==

Each webhook takes arguments in the form of a querystring encoded post body that should just work with existing form processing infrastructure.

Each webhook returns a JSON list, of the form [ boolean, object ]. The first argument signifies the authorization/success of the operation, and the object contains various options that vary by hook type.

All webhooks will have a "Cookie:" header with a value identical to the browser that caused the request to be initiated. The "context" of the webhook call should therefore contain a session for the originating browser.


=== connect ===

Request

    URL: [ROOT]/connect

Request Form:
    (empty)

Responses:
    true: Authorize connection
    false: Deny connection

Response Options
    name (optional): the Display Name for this connection; it will be used for presence.
    auto_subscribe (optional): (list) A list of channels to attempt to auto-subscribe the user. Each will generate a subscribe callback.
    auto_unsubscribe (optional): (list) A list of channels to attempt to auto-unsubscribe the user. Each will generate an unsubscribe callback.

=== create channel ===

Request
    URL: [ROOT]/create_channel

Request Form:
    destination: The channel's URI


Responses:
    true: Authorize channel creation
    false: Deny channel creation

Response Options
    history: (int, default 0) Specifies the amount of history that should be saved on the channel. When a user first subscribes they will be sent this history.
    set_history: (list, default []) Pre-populates history for the channel

Note: A create channel is issuing when a user subscribes to a non-existent destination. There will usually be a /subscribe callback immediately following a create_channel callback, unless the channel creation is denied.

=== publish ===

Request
    URL: [ROOT]/publish

Request Form:
    destination: The channel's URI
    payload: The json payload to be published

Responses:
    true: Authorize publishing
    false: Deny publishing

Response Options
    override_payload (optional): If specified, this payload will be delivered instead of the original payload
    auto_subscribe (optional): (list) A list of channels to attempt to auto-subscribe the user. Each will generate a subscribe callback.
    auto_unsubscribe (optional): (list) A list of channels to attempt to auto-unsubscribe the user. Each will generate an unsubscribe callback.


=== unsubscribe ===

Request
    URL: [ROOT]/unsubscribe

Request Form:
    destination: The channel's URI

Responses:
    true: Authorize unsubscribe
    false: Deny unsubscribe

Response Options
    auto_subscribe (optional): (list) A list of channels to attempt to auto-subscribe the user. Each will generate a subscribe callback.
    auto_unsubscribe (optional): (list) A list of channels to attempt to auto-unsubscribe the user. Each will generate an unsubscribe callback.


=== disconnect ===

Request
    URL: [ROOT]/disconnect

Request Form:
    channels: (list) The channels the users was in.

Responses:
    true: Required (Doesn't really do anything)
    false: Meaningless (but does the same as true.)

Response Options
    (None)

== Overview ==

A typical session with a Hookbox application might Look like this:

1) User navigates to http://www.example.com/index.html
    The user is given a login page, which he fills out.
2) Browser POSTs to http://www.example.com/login
    Included in the post body is the username and password
3) Web application returns Cookie: session_id=abc;
4) Web application redirects user to http://www.example.com/home
    The user is now logged into the application and sees the gui
5) Browser calls hookbox.connect('http://hookbox.example.com')
6) Browser send a CONNECT frame to hookbox, including { cookie: "session_id=abc"; }
7) Hookbox makes an HTTP POST to http://www.example.com/hookbox/connect
    Hookbox includes the header "Cookie: session_id=abc;"
8) The Web Application responds with a json payload: [ true, {}]
    This gives authorization for the client to connect
9) Browser calls hookbox.publish('test.location', ["Hello", "World"]

10) Hookbox makes an HTTP POST to http://www.example.com/hookbox/publish
    Hookbox includes the header "Cookie: session_id=abc;"
    Hookbox includes a query string in the POST body with the data
        payload=["Hello", "World"]
        channel_name=test.location
11) The Web app returns the json payload: [true, { } ]
    This gives authorization for the client to publish the message
12) Hookbox sends a PUBLISH frame to all clients currently subscribed to the
    channel 'test.location'

More Repositories

1

devkit

HTML 5 game platform for browser and mobile
JavaScript
615
star
2

webgl-2d

Canvas2D API in WebGL
JavaScript
509
star
3

js.io

Javascript Networking Library for building real-time web applications
JavaScript
294
star
4

orbited2

Next generation Orbited (putting a WebSocket in every browser.)
JavaScript
121
star
5

ff

Concise, powerful asynchronous flow control library for JavaScript
JavaScript
85
star
6

gcif

Game Closure Image Format
C++
85
star
7

hermes

Clojure wrapper for Titan
Clojure
37
star
8

isometric

JavaScript
26
star
9

spidermonkey-ios

Game Closure modified bleeding-edge Mozilla SpiderMonkey JavaScript engine
JavaScript
19
star
10

platformer

Platformer Framework for DevKit
JavaScript
17
star
11

timestep

JavaScript
16
star
12

native-ios

GC Native iOS
C
14
star
13

native-android

GC Native Android
C
14
star
14

csp_eventlet

A Comet Session Protocol implementation for eventlet
Python
13
star
15

squill

The foremost js.io UI package.
JavaScript
13
star
16

gcif-reader

Game Closure Image Format Reader
C++
13
star
17

whack-that-mole

A basic game and introduction to the Game Closure SDK.
JavaScript
12
star
18

devkit-core

JavaScript
11
star
19

native-core

GC Native Core
C
10
star
20

facebook

Game Closure DevKit Plugin: Facebook
Java
10
star
21

jash

jash
JavaScript
10
star
22

libstrophe-ios

iOS version of libstrophe that does not require OpenSSL
C
9
star
23

rtjp_eventlet

Simple RTJP implementation build on eventlet
Python
9
star
24

demoIsometricGame

JavaScript
9
star
25

blobblast

Blob Blast
JavaScript
8
star
26

swarm

Survive the swarm, as long as you can!
JavaScript
6
star
27

barista

serving you JS just to your specification
JavaScript
5
star
28

url-parser

url-parser extracted from Joyent's http-parser
C
5
star
29

demoMenus

JavaScript
5
star
30

menus

JavaScript
4
star
31

xx

Object Locking for JavaScript: It's what you need when you need it, but you have to wait in line to get it.
4
star
32

artTools

art tools
JavaScript
4
star
33

libjpeg-turbo-build-scripts

Build scripts for libjpeg-turbo (64-bit iOS) with SIMD
Shell
4
star
34

gamekit

Game Closure Devkit Plugin for iOS GameKit and Android Game Services
JavaScript
4
star
35

geoloc

Game Closure DevKit Plugin : Geolocation
Java
4
star
36

devkit-parallax

Easy-to-use, bidirectional, configurable parallax system
JavaScript
4
star
37

devkit-entities

A set of base classes to jump start your game on devkit!
JavaScript
4
star
38

comet

Official PixiJS Editor
TypeScript
3
star
39

accelerometer

Provides accelerometer for android dev-kit games
Java
3
star
40

billing

Game Closure DevKit Plugin : In-App Billing
Java
3
star
41

devkit-scene

The play's scene up on the high stage, the module to play the game.
JavaScript
3
star
42

devkit-effects

A set of easy to use effects to amp up any game on devkit!
JavaScript
3
star
43

appflood

Game Closure DevKit Plugin : App Flood
Objective-C
3
star
44

NativeInspector

Cleanroom implementation of Web Inspector for Android V8 Debug Server
JavaScript
3
star
45

sponsorpay

Game Closure Devkit Plugin : SponsorPay
Objective-C
3
star
46

shooter

JavaScript
2
star
47

bcif

Our branch of BCIF based off 1.0 beta from http://www.researchandtechnology.net/bcif/
Java
2
star
48

sharing

Sharing plugin for devkit
JavaScript
2
star
49

particle-editor

A particle editor for devkit applications
JavaScript
2
star
50

adventuremap

JavaScript
2
star
51

wordrace

fast-paced real-time multiplayer word game
JavaScript
2
star
52

ouya

Game Closure Devkit Plugin : OUYA
Java
2
star
53

appnext

Game Closure Devkit Plugin : Appnext
Objective-C
2
star
54

leadbolt

Game Closure DevKit Plugin : LeadBolt
Objective-C
2
star
55

googleanalytics

Game Closure Devkit Plugin : Google Analytics
Objective-C
2
star
56

demoShooter

JavaScript
2
star
57

tapjoy

Game Closure Devkit Plugin : Tapjoy
Objective-C
2
star
58

OpenSSL-SASL-iOS

Working build scripts for Xcode 5.0 build of OpenSSL 1.0.1e and SASL 2.1.25 for i386, armv7, and armv7s fat static library
C
1
star
59

devkit-spriter

JavaScript
1
star
60

mitri

The Mighty Triangle
JavaScript
1
star
61

trademob

Game Closure Devkit Plugin : TradeMob
Objective-C
1
star
62

gcapi

JavaScript
1
star
63

devkit-commands

JavaScript
1
star
64

chartboost

Game Closure Devkit Plugin : Chartboost
Objective-C
1
star
65

community-art

Community art
JavaScript
1
star
66

mopub

Game Closure DevKit Plugin : MoPub
Java
1
star
67

dark-side

a response-comparing proxy server made of pure evil
Python
1
star
68

jumptap

Game Closure Devkit Plugin : Jumptap
Objective-C
1
star
69

phaser-breakout

The phaser breakout example integrated with Devkit.
JavaScript
1
star
70

demoSponsorpay

Demo application for Sponsorpay/Fyber module for GameClosure Devkit
JavaScript
1
star
71

inmobi

Game Closure Devkit Plugin : InMobi
Objective-C
1
star
72

tapfortap

Game Closure DevKit Plugin : TapForTap
Objective-C
1
star
73

demo-photos

JavaScript
1
star
74

demoChartboost

DevKit Chartboost Module Demo
JavaScript
1
star
75

examples

Basil addon for example demos.
JavaScript
1
star
76

devkit-fuzz

JavaScript
1
star
77

devkit-plugin-builder

JavaScript
1
star
78

amplitude

Game Closure Devkit Plugin : Amplitude
Objective-C
1
star
79

angular-mergely

An angular wrapper for mergely
CSS
1
star
80

web-crypto-rsa-aes

library for encrypting strings with rsa+aes using WebCrypto (and asmcrypto.js fallback)
JavaScript
1
star
81

gem-prototype

HTML
1
star