- Init Project
$ npm i -g @nestjs/cli
$ nest new socket-io-tst
-
modify
README.md
-
upload to github
-
Add websockets
yarn add @nestjs/websockets @nestjs/platform-socket.io
yarn add -D @types/socket.io
-
Generate
Global-Channel
modulenest g mo global-channel
-
Test Socket works with Socket.io tester https://www.electronjs.org/apps/socket-io-tester
Basic config:
Address: http://localhost:8765
Namespace: global-channel
Send Message: global-channel
- Add server-static package to serve a basic index.html
yarn add @nestjs/serve-static
- Add VueJS HelloWorld
- Add socket.io Client & basic test msg Important The socket-io server/client versions must be compatible
- https://en.wikipedia.org/wiki/WebSocket
- https://socket.io/docs/
- https://docs.nestjs.com
- https://v3.vuejs.org/guide/introduction.html
- examples:
- https://medium.com/@phatdev/build-a-real-time-chat-application-with-websocket-socket-io-redis-and-docker-in-nestjs-499c2513c18
- https://blog.logrocket.com/scalable-websockets-with-nestjs-and-redis/