HTML and CSS Reference
Unlike WebSockets, in which you listen for message and connectivity events, Firebase events all deal with the
underlying object model. They are
2. child added
3. child changed
4. child removed
5. child moved
Because each property is individually addressable, on http://MyGame.firebaseIO-demo.com/ud7h3if/vitals/
weapons , you could trigger the child added or child removed handler functions when the player picks up or drops
a weapon or to monitor changes in health. All Firebase clients maintain a copy of the data and fire any attached
callbacks locally before the data are synced to the other clients. This system of eventual consistency means that
some clients may be in a transitional state for some time until all the data have been propagated. Firebase will merge
updates from clients as needed.
As a result, Firebase is great for turn-based games or even some light real-time games, but it doesn't offer enough
control for games such as GRITS or Rawkets.
Pusher is a software as a service (SaaS) provider of a hosted WebSocket API. Pusher includes fallbacks for
noncompliant browsers and libraries (both client and server) in many languages to give the developer a single API to
learn. Letting someone else deal with the WebSocket code frees you to offload those responsibilities to Pusher and just
work on integration. Many programming languages do have some sort of WebSocket API, but they generally aren't as
mature as Socket.io . If your application is not written in Node.js , you have to worry about finding a library or server
that supports even a fraction of what Socket.io does. Pusher gives you the best of both worlds: a mature and fully
featured solution and no responsibility to maintain a separate socket server.
Channels and Events
Channels are how Pusher implements its publish/subscribe (pub/sub) model. Channels roughly correspond to
Socket.io rooms and can be public or private. Private-channel members are authenticated by an endpoint on the
application server as part of the subscription process. Pusher also keeps a presence channel that lets an application
inquire about the channel's currently subscribed members. The beauty of Pusher's channel model is that there is only
one API to learn. Public, private, and presence channels are differentiated only by the default events to which they
subscribe and whether they require authentication.
Events are user- or system-defined states that trigger server or client code when that state is attained. All channels
are bound with events that are triggered when there is a successful new subscription or a subscription error. Presence
channels add events that are triggered when members are added or removed.
Pusher has a free tier and several paid tiers. The lower tiers can fit most small applications but don't offer secure
sockets layer (SSL) encryption.
Kaazing's commercial WebSocket platform offers the infrastructure and protocol libraries that make it easier
to build real-time, in-game experiences, such as peer-to-peer, chat, virtual-goods shopping, auctions, and
game-state notifications for players who are away from the game. Kaazing also provides hosted, cloud-based
WebSocket servers to take the hassle out of deployment. You can read more about Kaazing and gaming at