Your powerful network backend in C, with HTTP and Websocket support

View the Project on GitHub

facil.io - Native Pub/Sub

The facil.io framework offers a native Pub/Sub implementation which can be found in the “services” folder.

This Pub/Sub implementation covers the whole process cluster and it can be easily scaled by using Redis (which isn’t required except for horizontal scaling).

Connection based vs. non-connection based Pub/Sub

Pub/Sub can be implemented both as a connection based subscription, where a connection’s on_close callback unsubscribes from any existing subscriptions.

In these cases, messages can be either forwarded directly to the client or handled by a server-side callback.

An example for this approach can be seen in the chatroom example using the websocket_subscribe function. The same function could have been used with a server-side callback.

A non-connection based Pub/Sub allows a local event to fire whenever a message arrives.

This event allows the server to react to certain channels, allowing remotely published events (by clients or through Redis) to invoke server routines.

This approach uses the pubsub_subscribe function directly rather than a connection related function.

Details and Limitations: