mock-socket: WebSocket connected with query params won't send a message
With https://github.com/thoov/mock-socket/pull/271, "message" handler is never triggered if a WS had query params
const testServer = new Server('ws://localhost:8080');
testServer.on('connection', socket => {
socket.on('message', data => {
// never called
});
});
const mockSocket = new WebSocket('ws://localhost:8080?foo=bar');
mockSocket.onopen = function open() {
this.send('Testing');
};
That’s because in WS’ send handler lookup performed for the full URL, that includes query part const server = networkBridge.serverLookup(this.url);
About this issue
- Original URL
- State: closed
- Created 5 years ago
- Reactions: 3
- Comments: 15 (5 by maintainers)
Commits related to this issue
- Trim query part from URL where it's necessary. Fixes #274 — committed to evolution-gaming/mock-socket by pablobirukov 5 years ago
- Trim query part from URL where it's necessary. Fixes #274 — committed to evolution-gaming/mock-socket by pablobirukov 5 years ago
- Trim query part from URL where it's necessary. Fixes #274 (#275) — committed to thoov/mock-socket by pablobirukov 5 years ago
Any progress @thoov?
Yeah I think maybe attachServer needs to also
trimQueryPartFromURL?Still not working for me unless, I remove my query parms.