le-vlad / nestjs-uws

Simple WebSocket adapter for the NestJS framework and UWebsockets.js
MIT License
25 stars 11 forks source link

Is it working? #2

Open ecologicrecicla opened 3 years ago

ecologicrecicla commented 3 years ago

Is it working?

I tried to use but I can't connect

le-vlad commented 3 years ago

@ecologicrecicla Yeah. It works. But actually, there is an error while building this library in Docker.

chanphiromsok commented 3 years ago

I set port app.useWebSocketAdapter(new UWebSocketAdapter({ port: 8099 })); but i cant connect to "ws://localhost:8099"

le-vlad commented 3 years ago

@chanphiromsok Is it the same port as used in your HTTP server?

chanphiromsok commented 3 years ago

@heavenlyteam I test with same port and different port still can't connect ,I asked in discord nestjs also I think the problem maybe from nestjs package ws

le-vlad commented 3 years ago

@chanphiromsok Let me test it in several hours.

chanphiromsok commented 3 years ago

@heavenlyteam appreciate your support

le-vlad commented 3 years ago

@chanphiromsok Does your server write any logs while connecting?

chanphiromsok commented 3 years ago

@heavenlyteam it doesn't log any messages but error only in postman and test client websocket

le-vlad commented 3 years ago

@chanphiromsok So, basically, your webserver should write something like this

GET / HTTP/1.1 Host: localhost:8099 Connection: Upgrade Pragma: no-cache Cache-Control: no-cache User-Agent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_7) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/90.0.4430.212 Safari/537.36 Upgrade: websocket Origin: chrome://new-tab-page Sec-WebSocket-Version: 13 Accept-Encoding: gzip, deflate, br Accept-Language: ru-UA,ru;q=0.9,en-US;q=0.8,en;q=0.7,ru-RU;q=0.6,uk;q=0.5 Sec-WebSocket-Key: W14k7VhhAk3sikKM/h6wUQ== Sec-WebSocket-Extensions: permessage-deflate; client_max_window_bits

And what kind of error do you receive with Postman?

chanphiromsok commented 3 years ago

Error: Unexpected server response: 200 Handshake Details Request URL: http://localhost:8099/ Request Method: GET Status Code: 200 OK Request Headers Sec-WebSocket-Version: 13 Sec-WebSocket-Key: k7xsJqmTYvYs4tyznt7wcQ== Connection: Upgrade Upgrade: websocket Sec-WebSocket-Extensions: permessage-deflate; client_max_window_bits Host: localhost:8099 Response Headers content-type: application/json; charset=utf-8 content-length: 34 Date: Tue, 01 Jun 2021 15:12:09 GMT Connection: keep-alive my error

le-vlad commented 3 years ago

@chanphiromsok Provide please Nest.JS and node versions

chanphiromsok commented 3 years ago

"dependencies": { "@nestjs/common": "^7.0.0", "@nestjs/config": "^0.6.3", "@nestjs/core": "^7.0.0", "@nestjs/graphql": "^7.10.6", "@nestjs/passport": "^7.1.5", "@nestjs/platform-express": "^7.0.0", "@nestjs/platform-fastify": "^7.6.17", "@nestjs/platform-socket.io": "^7.6.17", "@nestjs/typeorm": "^7.1.5", "@nestjs/websockets": "^7.6.17", "@types/multer": "^1.4.5", "apollo-server-fastify": "2.24.1", "argon2": "^0.27.2", "class-transformer": "^0.4.0", "class-validator": "^0.13.1", "compression": "^1.7.4", "core-js": "^3.6.5", "crypto-js": "^4.0.0", "document-register-element": "1.13.1", "fastify": "3.0.0", "fastify-compress": "^3.5.0", "fastify-file-interceptor": "^1.0.5", "fastify-multer": "^2.0.2", "fastify-static": "^4.2.2", "fp-ts": "^2.10.5", "graphql": "^15.5.0", "graphql-tools": "^7.0.5", "multer": "^1.4.2", "nestjs-uws": "^1.0.11", "passport": "^0.4.1", "pg": "^8.6.0", "reflect-metadata": "^0.1.13", "regenerator-runtime": "0.13.7", "rxjs": "~6.6.3", "sharp": "^0.28.2", "styled-components": "5.2.1", "tslib": "^2.0.0", "typeorm": "^0.2.32" },

node-version: v14.15.3

le-vlad commented 3 years ago

As far as I see, you use the 7.x version of Nest.JS So, actually, it's related to #5

chanphiromsok commented 3 years ago

so it work on nestjs v5 ?

le-vlad commented 3 years ago

v6

chanphiromsok commented 3 years ago

thank you

jatin510 commented 3 years ago

Hi, can we run http and ws on the same port using this package using express. @heavenlyteam.

le-vlad commented 3 years ago

@jatin510 It is not possible.

jatin510 commented 3 years ago

Nowdays, uwebsocket provide functionality to run http as well as websocket using the uwebsocket.js library on the same port. Can we achieve this functionality using your module? @heavenlyteam

gamedevsam commented 2 years ago

v8?

dzcpy commented 2 years ago

v9?