Skip to content

Commit

Permalink
Add WebSocketStream::get_config method to get the WebSocket configu…
Browse files Browse the repository at this point in the history
…ration. (#900)
  • Loading branch information
mr-ns authored Nov 25, 2024
1 parent 11790d7 commit 4d57961
Showing 1 changed file with 6 additions and 1 deletion.
7 changes: 6 additions & 1 deletion poem/src/web/websocket/stream.rs
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ use std::{

use futures_util::{Sink, SinkExt, Stream, StreamExt};

use super::{utils::tungstenite_error_to_io_error, Message};
use super::{utils::tungstenite_error_to_io_error, Message, WebSocketConfig};
use crate::Upgraded;

/// A `WebSocket` stream, which implements [`Stream<Message>`] and
Expand All @@ -19,6 +19,11 @@ impl WebSocketStream {
pub(crate) fn new(inner: tokio_tungstenite::WebSocketStream<Upgraded>) -> Self {
Self { inner }
}

/// Returns a reference to the configuration of the stream.
pub fn get_config(&self) -> &WebSocketConfig {
self.inner.get_config()
}
}

impl Stream for WebSocketStream {
Expand Down

0 comments on commit 4d57961

Please sign in to comment.