mirror of
https://github.com/tokio-rs/axum.git
synced 2024-10-24 01:46:51 +02:00
6d787665d6
Example usage: ```rust use axum::{prelude::*, sse::{sse, Event, KeepAlive}}; use tokio_stream::StreamExt as _; use futures::stream::{self, Stream}; use std::{ time::Duration, convert::Infallible, }; let app = route("/sse", sse(make_stream).keep_alive(KeepAlive::default())); async fn make_stream( // you can also put extractors here ) -> Result<impl Stream<Item = Result<Event, Infallible>>, Infallible> { // A `Stream` that repeats an event every second let stream = stream::repeat_with(|| Event::default().data("hi!")) .map(Ok) .throttle(Duration::from_secs(1)); Ok(stream) } ``` Implementation is based on [warp's](https://github.com/seanmonstar/warp/blob/master/src/filters/sse.rs)
1.5 KiB
1.5 KiB
Changelog
All notable changes to this project will be documented in this file.
The format is based on Keep a Changelog, and this project adheres to Semantic Versioning.
Unreleased
- Implement
Stream
forWebSocket
(#52) - Implement
Sink
forWebSocket
(#52) - Implement
Deref
most extractors (#56) - Return
405 Method Not Allowed
for unsupported method for route (#63) - Add extractor for remote connection info (#55)
- Improve error message of
MissingExtension
rejections (#72) - Improve documentation for routing (#71)
- Clarify required response body type when routing to
tower::Service
s (#69) - Add
axum::body::box_body
to converting anhttp_body::Body
toaxum::body::BoxBody
(#69) - Add
axum::sse
for Server-Sent Events (#75) - Mention required dependencies in docs (#77)
- Fix WebSockets failing on Firefox (#76)
Breaking changes
None.
0.1.1 (30. July, 2021)
- Misc readme fixes.
0.1.0 (30. July, 2021)
- Initial release.