-
Notifications
You must be signed in to change notification settings - Fork 569
New issue
Have a question about this project? # for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “#”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? # to your account
transports-uws/polling.js: TypeError: res.onData is not a function #637
Comments
Hi! That sounds really weird. The source code is here: engine.io/lib/transports-uws/polling.ts Lines 166 to 180 in 49bb7cf
The question is: how can Are you able to reproduce? I wasn't with the following code: Server const { App } = require("uWebSockets.js");
const { Server } = require("socket.io");
const app = new App();
const io = new Server();
io.attachApp(app);
io.on("connection", (socket) => {
setInterval(() => {
socket.emit("wut", () => {
console.log("acked!");
});
}, 1000);
socket.on("woot", (cb) => {
cb();
});
});
app.listen(4000, (token) => {
if (!token) {
console.warn("port already in use");
}
}); Client const io = require("socket.io-client");
const socket = io("http://localhost:4000", {
transports: ["polling"]
});
socket.on("connect", () => {
console.log(`connect ${socket.id}`);
});
setInterval(() => {
socket.emit("woot", () => {
console.log("acked!");
});
}, 1000);
socket.on("wut", (cb) => {
cb();
}); |
When binding to an uWebSockets.js application, the server could crash with the following error: ``` TypeError: res.onData is not a function at Polling.onDataRequest (build/transports-uws/polling.js:133:13) at Polling.onRequest (build/transports-uws/polling.js:47:18) at callback (build/userver.js:80:56) ``` Related: #637
OK, so I've finally able to reproduce. It should be fixed by 45112a3, included in Thanks for raising the issue! Please reopen if needed. |
Hello,
When testing uws on our socket server, we found a issue. I have configured a socket-io client to only do polling as transport, but when sending the request from socket-io client to the socket-io server, i found this in my socket server console:
And then it crashes the node server.
The text was updated successfully, but these errors were encountered: