Description
Summary
The Go SDK currently has no way for callers to observe client-level lifecycle events (connection state changes, auth state changes). The Rust SDK exposes these via Client::subscribe_events() returning a stream of DiagnosticEvent. This issue ports that capability to the Go SDK.
Motivation
The Go TCP client already has TODO stubs in place for event emission, indicating this was anticipated:
foreign/go/client/tcp/tcp_core.go:399 — // TODO publish event
foreign/go/client/tcp/tcp_core.go:461 — // TODO event pushing logic
foreign/go/client/tcp/tcp_core.go:475 — `// TODO push shutdown event.
This is groundwork for adding a high-level IggyConsumer abstraction to the Go SDK (planned as a follow-up). Diagnostic events let the consumer detect disconnects, re-join consumer groups eagerly on reconnect, and resume cleanly. Beyond the consumer use case, the events are also useful for application-level observability (logging connection drops, exposing health metrics, etc.).
Scope
In scope:
- Add a
DiagnosticEvent type in foreign/go/contracts/ mirroring the Rust enum (5 variants, with a String() method matching the snake_case form used in Rust).
- Add
SubscribeEvents() <-chan DiagnosticEvent to the Client interface in foreign/go/contracts/client.go.
- Implement a small fan-out broadcaster in the TCP client so multiple subscribers can each receive every event independently.
- Wire emission into the TCP client:
Connected — on initial connect and on every successful auto-reconnect (existing reconnect loop at foreign/go/client/tcp/tcp_core.go:86-100, 351-401)
Disconnected — at the existing TODO at tcp_core.go:399
Shutdown — at the existing TODO at tcp_core.go:475
SignedIn — after successful LoginUser
SignedOut — after successful LogoutUser
- Integration test that subscribes, exercises connect → disconnect → reconnect → login → logout → close, and asserts the full event sequence is delivered.
Component
Go SDK
Proposed solution
No response
Alternatives considered
No response
Description
Summary
The Go SDK currently has no way for callers to observe client-level lifecycle events (connection state changes, auth state changes). The Rust SDK exposes these via
Client::subscribe_events()returning a stream ofDiagnosticEvent. This issue ports that capability to the Go SDK.Motivation
The Go TCP client already has TODO stubs in place for event emission, indicating this was anticipated:
foreign/go/client/tcp/tcp_core.go:399—// TODO publish eventforeign/go/client/tcp/tcp_core.go:461—// TODO event pushing logicforeign/go/client/tcp/tcp_core.go:475— `// TODO push shutdown event.This is groundwork for adding a high-level
IggyConsumerabstraction to the Go SDK (planned as a follow-up). Diagnostic events let the consumer detect disconnects, re-join consumer groups eagerly on reconnect, and resume cleanly. Beyond the consumer use case, the events are also useful for application-level observability (logging connection drops, exposing health metrics, etc.).Scope
In scope:
DiagnosticEventtype inforeign/go/contracts/mirroring the Rust enum (5 variants, with aString()method matching thesnake_caseform used in Rust).SubscribeEvents() <-chan DiagnosticEventto theClientinterface inforeign/go/contracts/client.go.Connected— on initial connect and on every successful auto-reconnect (existing reconnect loop atforeign/go/client/tcp/tcp_core.go:86-100, 351-401)Disconnected— at the existing TODO attcp_core.go:399Shutdown— at the existing TODO attcp_core.go:475SignedIn— after successfulLoginUserSignedOut— after successfulLogoutUserComponent
Go SDK
Proposed solution
No response
Alternatives considered
No response