Skip to content

WebSocketServerTransport suffers an unhandled exception on invalid JSON #748

@orlenko

Description

@orlenko

Describe the bug
Sending an invalid JSON string to WebSocketServerTransport causes the server to crash, because of an unhandled exception.

To Reproduce
Steps to reproduce the behavior:

  1. Create a basic application with WebSocketServerTransport, as described in the main README.
  2. Start the server
  3. Open a websocket from a browser, e.g. const ws = new WebSocket('ws://localhost:3331/');
  4. Send a string that is not valid JSON, e.g. ws.send('hi');
  5. The server crashes with an error.

Expected behavior
The server should respond with error code -32700, as per the specification.

Metadata

Metadata

Assignees

Labels

No labels
No labels

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions