explaingit

terry-mao/goim

7,369GoAudience · developerComplexity · 4/5LicenseSetup · hard

TLDR

goim is a high-performance instant messaging server in Go that pushes messages to millions of connected users at once via WebSocket, TCP, or HTTP long-polling, with a three-layer architecture designed for horizontal scaling.

Mindmap

mindmap
  root((goim))
    Architecture
      Comet layer
      Logic layer
      Job layer
    Connections
      WebSocket
      TCP
      HTTP long-poll
    Messaging
      Single user
      Group channel
      Broadcast all
    Scale
      1M clients
      35.9M msgs per sec
    Tech
      Go
      Kafka
Click or tap to explore — scroll the page freely

Code map

Detail Auto

An interactive map of this repo's files and how they connect — its source is parsed live in your browser. Click Visualize to build it.

filefunction / class

Things people build with this

USE CASE 1

Build a chat application backend that can handle millions of simultaneous users without changing a single service to scale up.

USE CASE 2

Add a real-time live comment feed to a streaming video platform using goim's broadcast capability.

USE CASE 3

Send targeted push notifications to individual users or chat room subscribers at high throughput.

USE CASE 4

Integrate an external message source via Kafka so goim's job layer dispatches messages to the right clients.

Tech stack

GoWebSocketTCPHTTPKafka

Getting it running

Difficulty · hard Time to first run · 1day+

Requires running three separate services plus a Kafka cluster for the job layer message queue.

Use freely for any purpose including commercial projects, as long as you keep the MIT license notice.

In plain English

goim is an instant messaging server written in Go, designed to handle a large number of simultaneous connected users. If you are building a chat app, a live comment feed, or any product where messages need to be pushed to many users at once, this provides the server infrastructure to do it. The server supports sending a message to a single user, to a list of users, or as a broadcast to everyone connected. Users can also subscribe to a shared key (similar to a chat room), and the server will forward messages to all subscribers of that key. The connection stays alive through heartbeat checks, which prevents the server from holding onto dead connections. Users must authenticate before they can subscribe, so anonymous connections are blocked. The architecture splits the work across three separate services that run independently. The comet layer manages the actual client connections over WebSocket, TCP, or HTTP long-polling. The logic layer handles the business rules for routing messages. The job layer receives messages from Kafka (a messaging queue) and dispatches them to the right comet nodes. This separation means you can run more instances of any layer to handle more load without changing the others. The README includes benchmark results from a test with one million connected clients. Running on a single server, the system delivered about 35.9 million received messages per second during broadcast testing, using around 14 GB of memory. That gives a rough sense of what kind of scale the server is built for. Client SDKs for Android and iOS are available in separate repositories linked from the README. A JavaScript WebSocket example is included in the main repository. The project is MIT licensed.

Copy-paste prompts

Prompt 1
Using goim, show me how to authenticate a user and subscribe them to a channel key so they receive group messages.
Prompt 2
Explain how to run goim's three services (comet, logic, job) separately and scale the comet layer independently.
Prompt 3
Write a JavaScript WebSocket client that connects to a goim server and listens for broadcast messages.
Prompt 4
How do I configure goim's job layer to consume messages from a Kafka topic and dispatch them to connected clients?
Prompt 5
How does goim use heartbeat checks to detect and clean up dead connections?
Open on GitHub → Explain another repo

← terry-mao on gitmyhub — every repo by this author, as a profile.

Verify against the repo before relying on details.