Building a kernel for a service similar to for real-time messaging

In this post, I'll tell you how I built a kernel for a service similar to

What is Pusher?

Pusher is a simple hosted API for quickly, easily and securely integrating real-time bi-directional functionality via WebSockets to web and mobile apps, or any other Internet-connected device.

What is our service?

Our service is called streamlab.

My key points while thinking about the structure

  • Simple Codebase.
  • Simple Design.
  • Low resources usage.
  • Don't re-invent the wheel.
  • Scalability.
  • App -> Channels -> Events Model.

What technologies did I use?

  • RethinkDB: I used rethinkdb as my default data storage, I store apps & its users in it, each app has channels and events, I didn't re-invent the wheel, but I used RethinkDB changes API to fetch all updates related to the specified channel/event(s), then broadcasting it to the subscribed clients VIA websocket.
  • Redis: I used redis as our configurations management system, It is fast, easy and simple.
  • Golang: The main programming language.
  • HTTPSify: for Auto SSL Certs to support wss protocol.