spark-server/.cursor/skills/spark-im-v3/invariants.md
2026-09-16 19:08:06 +08:00

624 B

V3 invariants (short)

ID Rule
C1 MySQL + Snowflake MsgId. No ConversationSeq.
C2 EventLoop ≠ MySQL. Fanout = Redis list + worker (BRPOPLPUSH).
C3 TLS + thin Frame. No custom handshake crypto.
C4 Public 443 / Nginx SNI. gnet is 127.0.0.1:9000.
C5 ACK = COMMIT + enqueue.
C6 PROXY RealIP for limit/audit.
C7 Dialog list in Redis ZSET. Mailbox only for missed push + control events.

P2P unique (user_small, user_big). Same device kicks old conn. Sender device excluded from MESSAGE. context.TODO() banned on hot path. Push timeout does not close TCP.