nestjs / nest

A progressive Node.js framework for building efficient, scalable, and enterprise-grade server-side applications with TypeScript/JavaScript 🚀
https://nestjs.com
MIT License
67.69k stars 7.63k forks source link

02-gateways not working #1584

Closed ningacoding closed 5 years ago

ningacoding commented 5 years ago

Cloned example project, so details of issue reproduction are skipped.

02-gateways, not working:

image

Nest Startup Logs:

nest-typescript-starter@1.0.0 start (etc)/nest-master/sample/02-gateways ts-node src/main.ts

[Nest] 14177 - 24/2/2019 11:16:48 [NestFactory] Starting Nest application... [Nest] 14177 - 24/2/2019 11:16:48 [InstanceLoader] ApplicationModule dependencies initialized +8ms [Nest] 14177 - 24/2/2019 11:16:48 [InstanceLoader] EventsModule dependencies initialized +0ms [Nest] 14177 - 24/2/2019 11:16:48 [NestApplication] Nest application successfully started +25ms

Client: image

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

ningacoding commented 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" });
});
kamilmysliwiec commented 5 years ago

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.

ningacoding commented 5 years ago

As i commented before, this is the minimal repository which reproduces the issue:

https://github.com/nestjs/nest/tree/master/sample/02-gateways

lock[bot] commented 5 years ago

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.