aim_server_sse 0.0.1 copy "aim_server_sse: ^0.0.1" to clipboard
aim_server_sse: ^0.0.1 copied to clipboard

Server-Sent Events (SSE) support for aim_server with real-time streaming capabilities.

0.0.1 #

Initial release - Server-Sent Events (SSE) support for Aim framework

Features #

  • Server-Sent Events streaming with c.sse() extension method
  • SseStream API with convenient methods:
    • send() for sending text events
    • sendJson() for sending JSON-encoded events
    • keepAlive() for connection keep-alive
    • comment() for debug comments
  • Support for event types, IDs, and retry intervals
  • Automatic connection cleanup on callback completion or error
  • Proper SSE protocol formatting with multi-line data support
  • Type-safe event handling with SseEvent class

Examples #

import 'package:aim_server/aim_server.dart';
import 'package:aim_server_sse/aim_server_sse.dart';

final app = Aim();

// Basic SSE
app.get('/events', (c) async {
  return c.sse((stream) async {
    stream.send('Hello, SSE!');
    stream.sendJson({'message': 'World!'}, event: 'greeting');
  });
});

// Real-time updates
app.get('/clock', (c) async {
  return c.sse((stream) async {
    while (true) {
      stream.sendJson({'time': DateTime.now().toIso8601String()});
      await Future.delayed(Duration(seconds: 1));
    }
  });
});
0
likes
160
points
0
downloads

Publisher

verified publisheraim-dart.dev

Weekly Downloads

Server-Sent Events (SSE) support for aim_server with real-time streaming capabilities.

Repository (GitHub)
View/report issues

Documentation

API reference

License

MIT (license)

Dependencies

aim_server

More

Packages that depend on aim_server_sse