Closed ningacoding closed 5 years ago
Client Code:
// socket.io-client: "2.1.1"
this.socket = io("//localhost:3000", {
reconnectionDelay: 1000, // we need this
reconnection: true,// we need this
reconnectionAttempts: 10,// we need this
transports: ["websocket"],// we need this
agent: false, // [2] Please don't set this to true
upgrade: false, // we need this
rejectUnauthorized: false // we need this
});
this.socket.on("error", (err) => {
console.log("SOCKET ERROR", err);
});
this.socket.on("disconnect", (err) => {
console.log("SOCKET DISCONNECT", err);
});
this.socket.on("connect_error", (err) => {
console.log("SOCKET CONNECT ERROR", err);
});
this.socket.on("reconnect", () => {
console.log("SOCKET RECONNECT");
});
this.socket.on("reconnect_attempt", () => {
console.log("SOCKET RECONNECT ATTEMPT");
});
this.socket.on("reconnecting", () => {
console.log("SOCKET RECONNECTING");
});
this.socket.on("reconnect_failed", (err) => {
console.log("SOCKET RECONNECT FAILED", err);
});
this.socket.on("reconnect_error", (err) => {
console.log("SOCKET RECONNECT ERROR", err);
});
this.socket.on("connect_timeout", (err) => {
console.log("SOCKET CONNECT TIMEOUT", err);
});
this.socket.on("connect", () => {
console.log("SOCKET IO CONNECTED", this.socket.id);
this.socket.send("message", { test: "test" });
});
socket.io-redis package missing
It's just an example adapter - not necessarily required by this example.
Please, provide a minimal repository which reproduces your issue.
As i commented before, this is the minimal repository which reproduces the issue:
https://github.com/nestjs/nest/tree/master/sample/02-gateways
This thread has been automatically locked since there has not been any recent activity after it was closed. Please open a new issue for related bugs.
Cloned example project, so details of issue reproduction are skipped.
02-gateways, not working:
Nest Startup Logs:
Client:
Details:
Even adding the missing package, WebSocket does not works, i'm ussing:
Plattform: Linux - Ubuntu 18.04.2LTS Node: v8.10.0 NPM: 3.5.2