Skip to main content

process_socket

Function process_socket 

Source
pub(crate) async fn process_socket(
    socket: WebSocket,
    state: AppState,
) -> Result<()>
Expand description

Handles one direct-mode WebSocket export session.

Reads the request with read_export_request and serves it with serve_export_request. If serving fails, it sends an error frame, a complete frame and a close frame, ignoring send failures. On success the socket is dropped after the complete frame without an explicit close frame.

§Arguments

  • socket - Upgraded WebSocket connection.
  • state - Shared exporter state.

§Errors

Returns an error if the request cannot be read or parsed, or if the process is in worker mode (not reached in practice, since worker mode starts no WebSocket server).