ebchat_core 1.1.1 copy "ebchat_core: ^1.1.1" to clipboard
ebchat_core: ^1.1.1 copied to clipboard

Pure-Dart client for the ebchat first-party livechat protocol: REST client, conversation controller and Pusher/Soketi realtime transport. No Flutter dependency. Most apps want the ebchat package, whic [...]

Changelog #

1.1.1 #

  • Docs: the LivechatApiClient.baseUrl example pointed at https://api.enable.tech, which is the Enable platform API, not the ebchat gateway. Calls sent there fail with a confusing 401 "Token is Not formed well" from a different service. The gateway is https://ebchat-backend.e-butler.com.

1.1.0 #

  • Delivery acks both ways: the controller acknowledges the newest inbound operator/bot message (debounced, cumulative — one ack per burst) so the operator's dashboard tick reflects that the guest's client actually has it.
  • LivechatMessage: new deliveredTo list and deliveryStatus getter with the LivechatDeliveryStatus enum (pending / sent / delivered / read / failed) for WhatsApp-style tick marks. Optimistic messages (local placeholder ids) report pending; failed is client-local, set when a send doesn't go through.
  • Reconnection: new realtimeFactory on EbchatConversationController — transports are single-use, so a factory is what makes reconnect possible at all. On socket death the controller flips to fast polling, retries with exponential backoff, and runs a 30 s safety poll even while connected (zombie sockets die without an onDone). New LivechatConnectionState (connected / reconnecting / pollingOnly) exposed as connectionState / currentConnectionState, plus resync() for app-resume refetch + socket revival.
  • Failed-send retry: network failures no longer delete the optimistic bubble — the message is kept, marked sendFailed, and retry(clientId) re-sends the exact same request (same idempotency key, so a duplicate is impossible even if the original landed). Only 409 conversation_closed still removes the bubble, since a retry can never succeed there.
  • Silent token refresh: new onAuthExpired callback — on an expired-token failure the controller re-mints once (single-flight across concurrent expiries), retries the failed call, and rebuilds the realtime socket on the new token. setTyping became best-effort (a lost typing signal costs an indicator, never a message).
  • Both error-envelope shapes parsed: the protocol's { error: { code } } AND the NestJS flat { statusCode, message, error } the gateway actually sends (machine code riding in message) — without this, isTokenExpired / isConversationClosed never matched real responses and silent re-session could never trigger.
  • No-op ingest detection: the polling refetch compares what the UI renders from (text, receipts, attachment actions, failure state) and skips the emit when nothing changed — the transcript no longer rebuilds every 5 seconds for no visible change.
  • LivechatMessage.isNote + the controller drops isNote messages at ingest: internal operator notes are never surfaced to a guest, even if a gateway sends one.
  • Pagination offset fix: the offset now advances by the raw page size whenever the server reports more (hasMore), so a page thinned by note-filtering no longer refetches the same window forever.
  • message.updated realtime events now apply seenBy / deliveredTo deltas (both wire shapes), so tick marks update live instead of only on refetch. Updates apply via copyWith and preserve every field the delta doesn't name — a delivery ack on an order message used to erase the receipt.

1.0.0 #

  • Initial ebchat_core: pure-Dart client for the livechat protocol v1.
  • Includes the Pusher/Soketi realtime transport (PusherConfig, PusherLivechatRealtime) — still no Flutter dependency.
  • Models: bootstrap config, session, conversation, message, attachment, choice action, location, send request.
  • LivechatApiClient covering all /livechat/v1 REST endpoints + typed LivechatApiException (conversation-closed / token-expired helpers).
  • EbchatConversationController: message state, optimistic send with clientId de-dupe, pagination, read/typing, and live updates via a pluggable LivechatRealtime transport or built-in polling.
  • SessionStore (in-memory default) for guest-session persistence.
0
likes
140
points
173
downloads

Documentation

API reference

Publisher

unverified uploader

Weekly Downloads

Pure-Dart client for the ebchat first-party livechat protocol: REST client, conversation controller and Pusher/Soketi realtime transport. No Flutter dependency. Most apps want the ebchat package, which adds the UI.

Homepage
Repository (GitHub)
View/report issues

Topics

#chat #messaging #support #livechat

License

MIT (license)

Dependencies

http, http_parser, meta, web_socket_channel

More

Packages that depend on ebchat_core