Coding a Simple WebSocket Server in Node.js that Scales!

Поділитися
Вставка
  • Опубліковано 9 бер 2023
  • A quick intro into coding a basic WebSocket server using the fast and efficient NPM package ws.
    GitHub Repo: github.com/covalence-io/ws-si...
    Express Template Repo: github.com/covalence-io/expre...
    Don't forget to like this video and subscribe to our channel - we're publishing more videos and walkthroughs every week. Comment below and let us know what you'd like to see next!
    Check us out at covalence.io
    Join the Covalence community: covalence.io/membership
    Shop Covalence merch: covalence.merchntly.com

КОМЕНТАРІ • 31

  • @dashaxedit
    @dashaxedit Рік тому +5

    We need more of the websocket lessons. Thank you, really apppreciate it. So much production-related use cases we are in demand of. Please make more videos! For example, how to send messages in controllers, how to separate websocket, how to authenticate etc. etc.

  • @abhilashmukherjee9536
    @abhilashmukherjee9536 3 місяці тому

    Really appreciate how you explained everything from scratch. Helped me build the basic intuition of websockets. Keep doing the good work. Cheers

  • @otmanm4095
    @otmanm4095 9 місяців тому +2

    That channel is so under rated

  • @datalyrics
    @datalyrics 9 місяців тому

    Everything is here. Not too much not too little and also the explanations for productive use are super. However, I admit that I always had to stop. The speed is ok nonetheless. Thank you very much for your effort. Without your video and GPT I would not be where I am now in 4 weeks!

    • @covalence-io
      @covalence-io  9 місяців тому

      Glad you're enjoying the content!

  • @WrestlingTournamentsDotCom
    @WrestlingTournamentsDotCom 9 місяців тому +1

    Hey Matt, good video, thank you for all your help. A suggestion for future videos, maybe zoom out a bit and make the window you're coding in a bit bigger; it would help me to see more of the code at once. Thank you.

    • @covalence-io
      @covalence-io  9 місяців тому +1

      Noted! Appreciate the feedback.

  • @stockanalogy8108
    @stockanalogy8108 Рік тому +1

    increase your sound in the video i will start watching your videos, you are creating quality content just keep it up, whenever I watch videos from this channel I have seen to grow their channel much faster after my continue watch. Quality content attracts me and youtube recommends that

  • @marvelfancollection3690
    @marvelfancollection3690 9 днів тому

    Bro great video..however can you increase your audio volume in future videos please..tx

  • @Varun-ms5iv
    @Varun-ms5iv 5 місяців тому

    Thank you for the tutorial very simple and very informative. Can you please share the resources you used to know about ws other than ws-docs.

    • @covalence-io
      @covalence-io  4 місяці тому

      Apologies, the only resources I have are from looking at their code, working with the library myself, and various feedback from the experiences of colleagues working with the libraries

  • @erice.3892
    @erice.3892 Рік тому +2

    could you do a video on amqplib and rabbitMQ?

  • @thomas-sinkala
    @thomas-sinkala 5 місяців тому

    At 8:33, you talked about auth, can you make video about this part?
    Thank you.

    • @covalence-io
      @covalence-io  4 місяці тому

      We have this video ua-cam.com/video/twNgfrE4ShE/v-deo.html you can check out!

  • @yapayzeka
    @yapayzeka 15 днів тому

    why if(!!ws) instead of if(ws)

  • @paulojo720
    @paulojo720 6 місяців тому

    My react app is unable to connect, am getting response 404 status

    • @covalence-io
      @covalence-io  5 місяців тому

      when are you getting a 404? when the websocket is trying to connect or when the page loads or what? where do you see the 404 error?

  • @andrewandrosow4797
    @andrewandrosow4797 Рік тому

    Hello! I tried to write a simple (non-scalable) web server. But there are in satellite phone networks a connection can be destroyed unexpectedly - but a channel of data transmission in phone stay alive (an indicator on a phone show that data transmission in action) . When a server sending ping to a client each minute (for example) - you can set timeout and kill the connection when a response has`n been received. But a client think - the connection is alive... In my opinion - the solution is the next: we can send from a frontend (browser) pings periodically and responding by a server. Timeout mechanisms must be on both sides: s frontend side and a backend side. But a browser hasn't any event handlers for websocket`s 'ping'. It also can't sends pings to server (a browser only responding on websocket pings) . In fact, I can`t listen 'ping' on a browser side. It`s a disadvantage. Classical TCP Socket in Nodejs can sending keep-alive events from a client or from a server side

    • @covalence-io
      @covalence-io  Рік тому +1

      We have another video that should solve this problem here! ua-cam.com/video/cUGRlM3SZ1w/v-deo.html

    • @andrewandrosow4797
      @andrewandrosow4797 Рік тому

      @@covalence-io Thanks!

  • @RecapFreak
    @RecapFreak 2 місяці тому

    Can we host this on vercel ?

    • @covalence-io
      @covalence-io  2 місяці тому +1

      I'm not sure if Vercel has websocket support or not. I would look into whether or not Next.js will work with websockets and if so then Vercel probably has some way to support them as well

    • @RecapFreak
      @RecapFreak 2 місяці тому

      @@covalence-io Yes I found out that vercel doesn't have support for websockets, so I hosted my backend on Render but it is little slow. I can see the delay in responses.

  • @akshatlifts1446
    @akshatlifts1446 7 місяців тому

    how to deploy it on server

  • @user-mq9dy2lj5u
    @user-mq9dy2lj5u 8 місяців тому

    Why do you use --save for, that is completely useless.

    • @covalence-io
      @covalence-io  8 місяців тому

      --save adds the package as a dependency in your package.json, if you do --save-dev it'll add it as a dev dependency

    • @user-mq9dy2lj5u
      @user-mq9dy2lj5u 8 місяців тому

      @@covalence-io all packages are saved to your list of dependencies since npm version 5 ^ --save-dev however is sill necessary to save to your list of dev dependencies.

    • @covalence-io
      @covalence-io  8 місяців тому

      @@user-mq9dy2lj5u old habits die hard haha. I explicitly use --save, --save-dev, and --no-save every time i install for some reason but yes you are 100% correct in that the --save is the default behavior

  • @user-mq9dy2lj5u
    @user-mq9dy2lj5u 9 місяців тому

    Can't trust somebody who is constantly looking at his notes, lol!

    • @covalence-io
      @covalence-io  9 місяців тому +2

      Actually you can trust that somebody way more...