$ show GoBelieveIO/im_service
GoBelieveIO/im_service is an instant messaging (IM) server infrastructure implemented in Go. It provides real-time peer-to-peer messaging, group chat (including super groups for large audiences), and chat rooms. The system is designed for clustered deployment and consists of three separate processes: `im` (access server handling client TCP/WebSocket connections), `ims` (storage server using append-only file logs with in-memory indexes), and `imr` (router server coordinating message delivery between access servers). Authentication is token-based (Redis or JWT). Message storage is per-user file-based with efficient offline message synchronization via sync keys. The codebase includes a custom binary protocol over TCP/WebSocket, a Redis-backed pub/sub mechanism for group events and relationship changes, and MySQL for group and friend data. This is a production-grade system (as indicated by its star count) with comprehensive benchmark tools and Python integration tests. However, the repository appears to be in a maintenance-stale state with no recent commits and some deprecated message types.
The LLM identified 3 files worth highlighting for reuse:
A generic LRU (Least Recently Used) cache implementation originally from Google. It supports setting a maximum number of entries, an eviction callback, and provides standard cache operations (Add, Get, Remove). The implementation uses a doubly-linked list and a hash map for O(1) operations. It is self-contained, has no external dependencies, and can be extracted into any Go project needing a simple LRU cache.
A generic set data structure using Go's built-in map. It provides Add, Remove, IsMember, Clone, and Count methods. The implementation is straightforward but demonstrates a clean use of Go generics (comparable type constraint) to create a reusable collection. It is self-contained and can be extracted as a utility library for any Go project requiring a set.
A set of generic HTTP handler wrappers that allow binding typed arguments to handler functions, reducing boilerplate when passing dependencies to HTTP handlers. It defines Handler, Handler2, Handler3 types with one, two, or three generic parameters, and corresponding Handle, Handle2, Handle3 functions. This pattern enables clean dependency injection for HTTP handlers without global state. It is self-contained and can be reused in any Go web server.