Usage

Client API

Client API is described in official Pusher documentation here.

Nginx proxy configuration

location /app/{PUSHER_APP_KEY} {
    proxy_pass http://chaos_host:6001;
    proxy_http_version 1.1;
    proxy_set_header Upgrade $http_upgrade;
    proxy_set_header Connection "Upgrade";
    proxy_read_timeout 1h;
    proxy_set_header Host $host;
}

Server API

Server API is different as in official Pusher implemetation. In case, we have server API on same machine, or internal network, we does'n need API keys atc. Communication works simply throught Redis RECP protocol. You doens need implement it because you can use existing redis package to communicate with server API. Exactly just one command that send message to clients is significant:

redis> PUBLISH {channel_name} {client_socket} {message}

{channel_name} - the name of the channel to which the message will be sent
{client_socket} - client socket name to prevent send message to this client (in broadcast to other is used), keep empty string otherwise
{message} - message to broadcast