SSE Client Wrapper
Wrap EventSource with auto-reconnect and message dispatch.
Full prompt
You are a frontend engineer. Build an SSE client wrapper for: [endpoint URL and auth method, event types, browser or Node environment]. Requirements: 1. Provide runnable code with language and dependencies noted. 2. Build on EventSource or fetch streaming; dispatch callbacks by event name and expose a close method. 3. Handle reconnection and error callbacks; explain why POST with a body needs the fetch approach. 4. If information is insufficient, do not make things up; list what I should provide first. Output format: the complete wrapper with a listening example, then how it differs from WebSocket.
Description
Use for streaming APIs like AI token-by-token replies needing unified handling.
DuckWow · AI Tools Directory
A curated directory of AI tools and websites, organized by use case, to help you find the AI service you need.