utd_channels 0.2.0
utd_channels: ^0.2.0 copied to clipboard
Standalone Pusher-style realtime SDK for UTD-Stream-Engine: channels (public/private/presence), event pub/sub, presence member lists, and typed connection lifecycle. Pure Dart — no Flutter, no UI, no [...]
Changelog #
0.2.0 #
Security hardening (from a full audit).
- TLS is enforced.
connectWebSocketTransportrefuses a non-wss://dial andobtainConnectionToken/obtainChannelGrantrefuse a non-https://endpoint (loopback exempt). NewUTDTransportSecurityexposes the policy and anallowInsecuredev escape hatch. - Defensive frame parsing.
UTDFrame.tryParsedegrades a non-objectdatato an empty map, drops frames larger thanUTDFrame.maxFrameBytes(1 MB), and the socket/client coerce error-, ack-, and presence-member fields instead of hard-casting — a hostile or buggy server can no longer crash the client. insecureDevelopmentstrategies throw in release (product) builds unlessUTDTransportSecurity.allowInsecureis set.
0.1.0 #
Initial release — the generic realtime core extracted from utd_signaling.
UTDChannelsClient: public /private-/presence-channels by name prefix, subscribe-before-connect queuing, automatic resubscription with fresh channel auth after every reconnect.- Stream-based event API:
bind,bindJson<T>,bindAll, plus a globaleventsstream. - Ack-based
triggerfor client events with local rule enforcement (client-prefix, private/presence only, subscribed only, ≤ 10 KB) and typed server errors (UTDRateLimitedException, …). - Presence: member snapshot on subscribe,
me,memberAdded/memberRemoved. UTDAuth(sealed):insecureDevelopment(publishable-key mint, dev only),tokenProvider,endpoint. Proactive re-mint before token expiry.UTDChannelAuth(sealed): Pusher-byte-compatibleendpointcontract (form-encodedsocket_id/channel_name,{auth, channel_data?}response — existingpusher-http-*/Laravel endpoints work unchanged),authorizercallback,insecureDevelopment.UTDSocket: request/ack correlation, capped exponential backoff with full jitter (ReconnectPolicy), keepalive probing (KeepAlivePolicy), fatal close-code handling (4000–4099, 4003 →signedInElsewhere), and therequest()/framesescape hatches domain layers build on.- Machine-readable error codes only — no message sniffing.