Validates and parses a WebSocket frame.
This function checks that the input is a valid GatewayFrame and returns the parsed frame. Throws ValidationError if the input is invalid.
Unknown data to validate as a frame
The validated frame
ValidationError if the frame is invalid
const frame = validateFrame({ type: 'req', id: '1', method: 'ping', params: {} });// frame is typed as RequestFrame Copy
const frame = validateFrame({ type: 'req', id: '1', method: 'ping', params: {} });// frame is typed as RequestFrame
Validates and parses a WebSocket frame.
This function checks that the input is a valid GatewayFrame and returns the parsed frame. Throws ValidationError if the input is invalid.