Closed
Description
I'm encountering a problem in my local development environment when using MSW with Socket.IO. For some strange reason, MSW is able to intercept a plain WebSocket connection when I use:
new WebSocket("ws://localhost:3000/socket.io/?EIO=4&transport=websocket");
However, it fails to intercept when I use the Socket.IO client:
const socket = io("ws://localhost:3000", {
retries: 1,
transports: ["websocket"],
port: 3000,
});
socket.connect();
Note that Socket.IO client automatically appends /socket.io/
to the URL, so both are attempting to connect to the same endpoint.
I have created a minimal reproduction:
The GitHub repo might be more reliable for reproduction.
Any idea what I might be doing wrong or what modifications are needed to allow MSW to intercept Socket.IO connections as it does with a plain WebSocket?
Thanks in advance for your help!
Metadata
Metadata
Assignees
Labels
No labels