juice_realtime 0.2.0
juice_realtime: ^0.2.0 copied to clipboard
Persistent realtime connections (WebSocket/SSE) with auto-reconnect as a Juice bloc, behind a swappable seam.
Changelog #
All notable changes to this project will be documented in this file.
The format is based on Keep a Changelog, and this project adheres to Semantic Versioning.
0.2.0 - 2026-08-12 #
Changed #
- Require
juice ^1.6.0and declare a concurrency mode for every event. - Use
droppablefor initialization, connect/reconnect/disconnect, and connection-loss handling; keep the shared_connectingguard because connect and reconnect are different event types. - Run outbound sends, connection-established updates, and inbound message
updates
sequentially to preserve ordering and state mutation safety.
Fixed #
- Reject stale connector completions and callbacks with a connection epoch, so disconnecting during a pending connect cannot be undone by its late result.
- Cancel a scheduled reconnect when a user initiates a fresh connect.
- Detach connection resources before awaiting their cleanup, making overlapping lifecycle teardown safe and idempotent.
Tests #
- Add gated coverage for connect/reconnect exclusion, disconnect versus a late connect completion, manual-connect timer supersession, and outbound FIFO ordering; burst messages verify ordered delivery and counting.
0.1.1 - 2026-05-28 #
Fixed #
- Overlapping connects now open only one connection (added a
_connectingguard toConnectEvent/ReconnectEvent) — a connect fired during an in-flight connect previously tore down and re-opened, risking a dangling subscription.
0.1.0 - 2026-05-28 #
Added #
- Initial release.
RealtimeBloc— a persistent realtime connection with connection status as state and automatic reconnection (exponential backoff).RealtimeConnector/RealtimeConnection— vendor seam (one connect attempt = one connection). DefaultWebSocketRealtimeConnector(web_socket_channel; mobile/desktop/web). SSE or a vendor SDK can implement the same seam.- Message delivery —
bloc.messagesbroadcast stream (every message, for consumers like chat) plusstate.lastMessage+ therealtime:messagegroup (latest, for simple widgets). - Reconnection — configurable
initialBackoff/maxBackoff/maxReconnectAttempts; gives up loudly when exhausted. Manualdisconnect()suppresses reconnection. - Fail-loud send —
send()while not connected surfaces an error (never a silent drop). - Rebuild groups —
realtime:status,realtime:message.
Not yet included #
- SSE / topic multiplexing — both fit behind the existing seam; planned post-0.1.