Skip to content

Conversation

@daffl
Copy link
Member

@daffl daffl commented Aug 15, 2025

With the web standard implementation of the HTTP transport and the JS generator support for service methods we can add a service that provides an endpoint for streaming service events as server sent events (SSE).

Closes #369

@daffl daffl changed the title feat: SSE real-time event implementation feat: SSE real-time events Aug 15, 2025
@daffl daffl added this to the v6 milestone Aug 15, 2025
@cloudflare-workers-and-pages
Copy link

cloudflare-workers-and-pages bot commented Aug 15, 2025

Deploying feathers-dove with  Cloudflare Pages  Cloudflare Pages

Latest commit: 356555d
Status: ✅  Deploy successful!
Preview URL: https://2a8672e1.feathers.pages.dev
Branch Preview URL: https://v6-sse.feathers.pages.dev

View logs

Copy link
Member

@marshallswain marshallswain left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Issue: Library shouldn't log directly to console

Current:

try {
  client.service(payload.path).emit(payload.event, payload.data)
} catch (error) {
  console.error(error) // ❌ Library shouldn't log directly
}

Suggested:
try {
  client.service(payload.path).emit(payload.event, payload.data)
} catch (error) {
  sseService.emit('error', error) // ✅ Let the app decide what to do
}

Why this matters:
1. Library best practice - Applications should control their own logging/error
reporting
2. Event processing errors - This catches errors in user event handlers that apps may
want to handle differently
3. Consistency - SSE client already emits 'connected' and 'disconnected' events

Unlike internal parsing errors (which can be silently handled), this error occurs when
processing user events - something the application should be aware of and potentially
handle (invalid service paths, malformed payload data, user handler exceptions, etc.).

@daffl daffl merged commit fbfb75c into v6 Aug 20, 2025
5 checks passed
@daffl daffl deleted the v6-sse branch August 20, 2025 16:43
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants