Skip to content

Commit 4d57961

Browse files
authored
Add WebSocketStream::get_config method to get the WebSocket configuration. (#900)
1 parent 11790d7 commit 4d57961

File tree

1 file changed

+6
-1
lines changed

1 file changed

+6
-1
lines changed

poem/src/web/websocket/stream.rs

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ use std::{
66

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

9-
use super::{utils::tungstenite_error_to_io_error, Message};
9+
use super::{utils::tungstenite_error_to_io_error, Message, WebSocketConfig};
1010
use crate::Upgraded;
1111

1212
/// A `WebSocket` stream, which implements [`Stream<Message>`] and
@@ -19,6 +19,11 @@ impl WebSocketStream {
1919
pub(crate) fn new(inner: tokio_tungstenite::WebSocketStream<Upgraded>) -> Self {
2020
Self { inner }
2121
}
22+
23+
/// Returns a reference to the configuration of the stream.
24+
pub fn get_config(&self) -> &WebSocketConfig {
25+
self.inner.get_config()
26+
}
2227
}
2328

2429
impl Stream for WebSocketStream {

0 commit comments

Comments
 (0)