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)
33 lines
1.5 KiB
Markdown
33 lines
1.5 KiB
Markdown
# Changelog
|
|
|
|
All notable changes to this project will be documented in this file.
|
|
|
|
The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/),
|
|
and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).
|
|
|
|
# Unreleased
|
|
|
|
- Implement `Stream` for `WebSocket` ([#52](https://github.com/tokio-rs/axum/pull/52))
|
|
- Implement `Sink` for `WebSocket` ([#52](https://github.com/tokio-rs/axum/pull/52))
|
|
- Implement `Deref` most extractors ([#56](https://github.com/tokio-rs/axum/pull/56))
|
|
- Return `405 Method Not Allowed` for unsupported method for route ([#63](https://github.com/tokio-rs/axum/pull/63))
|
|
- Add extractor for remote connection info ([#55](https://github.com/tokio-rs/axum/pull/55))
|
|
- Improve error message of `MissingExtension` rejections ([#72](https://github.com/tokio-rs/axum/pull/72))
|
|
- Improve documentation for routing ([#71](https://github.com/tokio-rs/axum/pull/71))
|
|
- Clarify required response body type when routing to `tower::Service`s ([#69](https://github.com/tokio-rs/axum/pull/69))
|
|
- Add `axum::body::box_body` to converting an `http_body::Body` to `axum::body::BoxBody` ([#69](https://github.com/tokio-rs/axum/pull/69))
|
|
- Add `axum::sse` for Server-Sent Events ([#75](https://github.com/tokio-rs/axum/pull/75))
|
|
- Mention required dependencies in docs ([#77](https://github.com/tokio-rs/axum/pull/77))
|
|
- Fix WebSockets failing on Firefox ([#76](https://github.com/tokio-rs/axum/pull/76))
|
|
|
|
## Breaking changes
|
|
|
|
None.
|
|
|
|
# 0.1.1 (30. July, 2021)
|
|
|
|
- Misc readme fixes.
|
|
|
|
# 0.1.0 (30. July, 2021)
|
|
|
|
- Initial release.
|