Skip to content

feat: add real-time event polling support#12

Merged
mpge merged 2 commits into
mainfrom
feat/realtime-broadcasting
Apr 8, 2026
Merged

feat: add real-time event polling support#12
mpge merged 2 commits into
mainfrom
feat/realtime-broadcasting

Conversation

@mpge

@mpge mpge commented Apr 8, 2026

Copy link
Copy Markdown
Member

Summary

  • Add BroadcastService that hooks into ticket lifecycle actions (escalated_ticket_created, escalated_ticket_status_changed, escalated_reply_created, etc.) to store events in a WordPress transient buffer
  • Event types: ticket.created, ticket.updated, ticket.statusChanged, reply.created, ticket.assigned
  • REST polling endpoint: GET /escalated/v1/events?since={timestamp} returns events newer than the given timestamp
  • Additional endpoint: GET /escalated/v1/events/types lists supported event types
  • Configurable via escalated_broadcasting_enabled setting (default: false)
  • Buffer auto-caps at 100 events with 5-minute TTL
  • Registered in Api_Bootstrap and class-escalated.php

Test plan

  • Verify broadcasting disabled by default
  • Verify enable/disable toggle
  • Verify event push stores correct data with required fields
  • Verify unique event IDs
  • Verify filtering by timestamp (since parameter)
  • Verify buffer caps at 100 events, dropping oldest
  • Verify clear events empties buffer
  • Verify lifecycle hooks push correct event types
  • Verify ticket.assigned event payload

mpge added 2 commits April 8, 2026 09:04
Add BroadcastService that hooks into ticket lifecycle actions to store
events in a WordPress transient buffer. Events include ticket.created,
ticket.updated, ticket.statusChanged, reply.created, and
ticket.assigned. REST polling endpoint GET /escalated/v1/events?since=
returns events newer than the given timestamp. Configurable via
escalated_broadcasting_enabled setting (default: false). Buffer auto-
caps at 100 events with 5-minute TTL. Includes PHPUnit tests covering
event push, filtering, buffer limits, lifecycle hooks, and toggle.
Merge main into broadcasting branch, resolve API bootstrap and
escalated.php conflicts to include all controllers and services.
Apply Pint formatting fixes.
@mpge
mpge merged commit 5fc4233 into main Apr 8, 2026
1 of 3 checks passed
@mpge
mpge deleted the feat/realtime-broadcasting branch April 8, 2026 13:12
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant