The core concepts of PushJS

Learn how PushJS works in the background and how it handles the client/message sending.

What is PushJS

PushJS is a socket server where clients can connect to. It features a message queue with a FIFO system
It uses it's own protocol to communicate with and how to understand the client communication.

Clients

A device, such as a browser on a tablet or a smartphone for example, which is connected to PushJS is considered a client.
A client can connect to PushJS through several of our SDK's. Currently there is the Javascript and PHP SDK but soon also the iOS and Android SDK.

clients

Channels

Every user/account will get their own global channel. A channel is nothing more than a room of connected clients which are capable to communicate with and to each other.

Take a look at the following scheme. By default, any client that is connected to your app, is pushed into the global channel.
The global channel will dispatch system events and all your defined custom events. Once a client is into the global channel it is capable of creating a custom channel. Just like the global channel it will receive system events and custom events.
The only difference lies in the custom events/listeners. System events like CLIENT_ENTER will be dispatched in all channels whereas custom events will only be dispatched in a defined channel.

channels

Some examples of a channel:

  1. A private one to one chat, this channel will contain no more than 2 clients
  2. A public chat, this channel will contain many clients
  3. A limited chat, this channel will contain a number of specified clients