MCPcopy Create free account
hub / github.com/0x676e67/wreq-python / execute_websocket_request

Function execute_websocket_request

src/client/opts.rs:186–301  ·  view source on GitHub ↗

Executes a WebSocket request.

(
    client: Client,
    url: U,
    mut params: Option<WebSocketParams>,
)

Source from the content-addressed store, hash-verified

184
185/// Executes a WebSocket request.
186pub async fn execute_websocket_request<U>(
187 client: Client,
188 url: U,
189 mut params: Option<WebSocketParams>,
190) -> PyResult<WebSocket>
191where
192 U: AsRef<str>,
193{
194 let params = params.get_or_insert_default();
195 let mut builder = client.websocket(url.as_ref());
196
197 // The protocols to use for the request.
198 apply_option!(apply_if_some, builder, params.protocols, protocols);
199
200 // The WebSocket config
201 apply_option!(
202 apply_if_some,
203 builder,
204 params.read_buffer_size,
205 read_buffer_size
206 );
207 apply_option!(
208 apply_if_some,
209 builder,
210 params.write_buffer_size,
211 write_buffer_size
212 );
213 apply_option!(
214 apply_if_some,
215 builder,
216 params.max_write_buffer_size,
217 max_write_buffer_size
218 );
219 apply_option!(
220 apply_if_some,
221 builder,
222 params.max_frame_size,
223 max_frame_size
224 );
225 apply_option!(
226 apply_if_some,
227 builder,
228 params.max_message_size,
229 max_message_size
230 );
231 apply_option!(
232 apply_if_some,
233 builder,
234 params.accept_unmasked_frames,
235 accept_unmasked_frames
236 );
237
238 // Use http2 options.
239 apply_option!(
240 apply_option_or_default,
241 builder,
242 params.use_http2,
243 use_http2,

Callers 3

websocketMethod · 0.85
websocketMethod · 0.85

Calls 1

websocketMethod · 0.45

Tested by

no test coverage detected