Skip to main content

References and Resources

Official Specifications

Documentation and Tutorials

MDN Web Docs

  • Using Server-Sent Events
    • Comprehensive guide from Mozilla Developer Network
    • Includes browser compatibility information
    • Client and server implementation examples

HTML5 Tutorials

JavaScript Libraries

  • yaj-sse
    • SSE Polyfill without jQuery dependency
    • Port from version 0.1.4 of jQuery SSE
    • Lightweight and framework-agnostic

Server Implementations

PHP

header('Content-Type: text/event-stream');
header('Cache-Control: no-cache');
echo "data: message\n\n";
flush();

Node.js

res.writeHead(200, {
'Content-Type': 'text/event-stream',
'Cache-Control': 'no-cache',
'Connection': 'keep-alive'
});
res.write('data: message\n\n');

Python (Flask)

from flask import Response, stream_with_context

def event_stream():
yield 'data: message\n\n'

@app.route('/stream')
def stream():
return Response(event_stream(), mimetype='text/event-stream')

Browser Support

Native EventSource Support

BrowserVersionSupport
Chrome6+✅ Full support
Firefox6+✅ Full support
Safari5+✅ Full support
Opera11+✅ Full support
Edge79+✅ Full support (Chromium)
IEAll❌ No support

Polyfill Coverage

jQuery SSE provides automatic fallback for browsers without native support using Ajax long-polling.

Alternative Technologies

WebSockets

  • Pros: Full-duplex communication, lower latency
  • Cons: More complex, requires special server support
  • Use case: Real-time bidirectional communication (chat, gaming)

Server-Sent Events (SSE)

  • Pros: Simple HTTP-based, automatic reconnection, event IDs
  • Cons: Unidirectional (server to client only)
  • Use case: Live updates, notifications, news feeds

Long Polling

  • Pros: Works everywhere, simple
  • Cons: Higher overhead, more resource intensive
  • Use case: Fallback for older browsers

Community and Support

GitHub Repository

  • jquery-sse
    • Source code
    • Issue tracker
    • Pull requests welcome

NPM Package

jsDelivr CDN

License

This project is licensed under the MIT License. See the LICENSE file for details.

Contributing

Contributions are welcome! Please feel free to submit pull requests or open issues on GitHub.

Development Setup

# Clone the repository
git clone https://github.com/byjg/jquery-sse.git

# Install dependencies (if any)
npm install

# Run examples
docker run -it --rm -p 8080:80 -v $PWD:/var/www/html byjg/php:7.4-fpm-nginx

Credits

Created and maintained by João Gilberto Magalhães (JG)

Part of Open Source ByJG