Tick.io is a realtime tick-based synchronization module for NodeJS built on top of socket.io.
WARNING: DO NOT USE THIS MODULE. IT IS UNDER ACTIVE DEVELOPMENT AND IS NOT READY FOR PRODUCTION OR DEVELOPMENT USE.
Please note that this README may be out of date. For the most up to date README, view this repo on Github.
Install Node module
Use npm to install tick.io. Alternatively, you may download the server-side script directly from here.
Note: tick.io has only been tested with the
0.9.x branch of socket.io.
Listen on server
Tick.io must be included after socket.io.
var app =
tick = ;
Include client-side script
Download the client-side script directly from here.
How to use
You can feel free to check out the examples directory for
On the client side, a bare minimum tick.io app must connect to a server and should have a catch-all callback defined.
Note: In tick.io, an event is guaranteed to exist and is always a string.
- description: The connect event is fired whenever a new remote connection is established.
- example: Client A connects, clients B and C will receive the connect event.
- description: The disconnect event is fired whenever the connection to a remote client is lost.
- example: Client A disconnects, clients B and C will receive the disconnect event.
- description: The incoming event is fired when data from a remote connection is delivered to a client.
- example: Client A sends data, clients B and C will receive the incoming event.
- description: The init event is fired locally only for the client that has successfully connected to the server.
- example: Client A connects, client A recieves the init event.
- description: The tick event is fired at specified time intervals. It enables a client to send data to remote clients at a predictable
- example: x milliseconds pass, clients A, B, and C will each receive their own respective tick events. These tick events
are not guaranteed to fire at the same time.
For the sake of clarity,
inObj will refer to the object passed into your catch-all callback function as the second
argument. However, it is important to note that the actual name of this object is arbitrary. The following properties
are automatically accessible by your callback, although some of these properties may not always be set (see Events).
- type: arbitrary
- description: data is the information sent to this client by a remote client. Data can be anything and is
not used by tick.io directly. As the developer, it is up to you to determine what data is and how you will process it.
- type: string
- description: origin is the socket ID of the remote connection which produced the event.
- type: array
- description: pool is the list of all remote socket ID's currently able to communicate with this client.
The length of pool can be used to determine the number of other clients connected to this client.
- type: number
- description: tick is a message counter that is unique per client. All messages from clients are also given
a tick number.