Skip to content

Comments

Add Server-Sent Events for real-time table notifications#408

Draft
Copilot wants to merge 6 commits intodevelopmentfrom
copilot/add-server-sent-events
Draft

Add Server-Sent Events for real-time table notifications#408
Copilot wants to merge 6 commits intodevelopmentfrom
copilot/add-server-sent-events

Conversation

Copy link
Contributor

Copilot AI commented Feb 10, 2026

Implements real-time table updates via SSE. When mutations occur, subscribed clients receive events and auto-refresh affected tables.

Backend

SSE Infrastructure (apps/api/src/sse/)

  • SSEManager: Connection registry with resource-based subscriptions
  • Route at /api/events: Streams events with 30s heartbeat
  • Authentication: JWT via query param (EventSource header limitation)
  • Helper: emitTableUpdate(resource) called post-mutation

Integration Points

async handler(options) {
  const result = await prisma.veranstaltung.create({ ... })
  emitTableUpdate('veranstaltung')  // Broadcasts to subscribed clients
  return result
}

Currently integrated: veranstaltung create/update, anmeldung create/update

Frontend

SSE Composable (apps/frontend/src/composables/useSSE.ts)

  • Singleton service with exponential backoff (max 5 attempts, 30s cap)
  • Auto-subscribe on mount, cleanup on unmount
  • 10s connection timeout

Usage Pattern

const dataTableRef = ref<{ query: ReturnType<Query<T>> }>()

useSSE('veranstaltung', () => {
  dataTableRef.value?.query.refetch()
})

Integrated: VeranstaltungList, AnmeldungenTable

Architecture Notes

  • One persistent HTTP connection per client
  • Events only sent to subscribed resources (no broadcast to all)
  • No guaranteed delivery (missed events during disconnect acceptable)
  • Extends to new resources via 2-line mutation integration + composable call

Warning

Firewall rules blocked me from connecting to one or more addresses (expand for details)

I tried to connect to the following addresses, but was blocked by firewall rules:

  • checkpoint.prisma.io
    • Triggering command: /opt/hostedtoolcache/node/24.13.0/x64/bin/node /opt/hostedtoolcache/node/24.13.0/x64/bin/node /home/REDACTED/work/brahmsee.digital/brahmsee.digital/node_modules/.pnpm/prisma@5.22.0/node_modules/prisma/build/child {&#34;product&#34;:&#34;prisma&#34;,&#34;version&#34;:&#34;5.22.0&#34;,&#34;cli_install_type&#34;:&#34;local&#34;,&#34;information&#34;:&#34;&#34;,&#34;local_timestamp&#34;:&#34;2026-02-10T21:42:10Z&#34;,&#34;project_hash&#34;:&#34;b6c57c18&#34;,&#34;cli_path&#34;:&#34;/home/REDACTED/work/brahmsee.digital/brahmsee.digital/apps/api/node_modules/prisma/build/index. (dns block)

If you need me to access, download, or install something from one of these locations, you can either:

Original prompt

This section details on the original issue you should resolve

<issue_title>[Feature] Server Sent Events (SSE) für Tabellen</issue_title>
<issue_description>### Kurzbeschreibung

Wenn neue Daten verfügbar sind, soll der Nutzer eine Benachrichtigung bekommen.

Beschreibung

TODO: AUSFORMULIEREN @supermomme </issue_description>

Comments on the Issue (you are @copilot in this section)


💬 We'd love your input! Share your thoughts on Copilot coding agent in our 2 minute survey.

Copilot AI and others added 5 commits February 10, 2026 21:39
Co-authored-by: danielswiatek <9080990+danielswiatek@users.noreply.github.com>
Co-authored-by: danielswiatek <9080990+danielswiatek@users.noreply.github.com>
Co-authored-by: danielswiatek <9080990+danielswiatek@users.noreply.github.com>
…imeout

Co-authored-by: danielswiatek <9080990+danielswiatek@users.noreply.github.com>
Co-authored-by: danielswiatek <9080990+danielswiatek@users.noreply.github.com>
Copilot AI changed the title [WIP] Add server sent events for table notifications Add Server-Sent Events for real-time table notifications Feb 10, 2026
Copilot AI requested a review from danielswiatek February 10, 2026 21:50
// Set up SSE to auto-refresh table when data changes
useSSE('veranstaltung', () => {
console.log('Veranstaltung table updated, refreshing...')
dataTableRef.value?.query.refetch()
Copy link
Collaborator

Choose a reason for hiding this comment

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

Suggested change
dataTableRef.value?.query.refetch()
query.refetch()

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.

[Feature] Server Sent Events (SSE) für Tabellen

3 participants