How to use WebSockets with React and Node

แชร์
ฝัง
  • เผยแพร่เมื่อ 14 ต.ค. 2024

ความคิดเห็น • 56

  • @robcataus
    @robcataus 5 หลายเดือนก่อน +38

    I’m the author of react-use-websocket, and stumbled on this video. Your kind words made my weekend!❤

    • @AblyRealtime
      @AblyRealtime  5 หลายเดือนก่อน +3

      Great to hear from you, and thanks for commenting ❤️

    • @bookercodes
      @bookercodes 5 หลายเดือนก่อน +4

      Haha, no way, amazing to see you here! Great work on react-use-websocket!

  • @gabrielvaz8083
    @gabrielvaz8083 6 หลายเดือนก่อน +7

    This is HIGH-level content, 10/10 quality, 10/10 content, I'm shocked by the low viewership, I wish you all the best on your journey as a content creator

  • @Cyandog
    @Cyandog 10 หลายเดือนก่อน +7

    This video is just so good. EXTREMELY high quality content. Thank you very much! This is the type of video that not only adds value to other people but make them remember you and your business.
    Will recommend this to anyone looking to learn about WS!
    Wish you the utmost success!

    • @AblyRealtime
      @AblyRealtime  10 หลายเดือนก่อน +1

      Thanks for the kind words! Glad to hear you like the video.

    • @Cyandog
      @Cyandog 10 หลายเดือนก่อน

      ​@@AblyRealtimei got a few questions if possible. Could you make just one users object and put the connections there? Also, the on message handler needs to be inside the on connection one?

    • @AblyRealtime
      @AblyRealtime  10 หลายเดือนก่อน +1

      ​@@Cyandog You can structure the code that way if you prefer! There's no implication on functionality or performance, so it really comes down to your preference and what you find most logical to follow.
      Regarding the message handler - yep, that's right! - Alex

  • @isabelladavila3834
    @isabelladavila3834 2 หลายเดือนก่อน

    So easy to follow and explained every step! Best cursor WebSocket video out there. Thank you!!!

    • @AblyRealtime
      @AblyRealtime  2 หลายเดือนก่อน

      Thanks very much Isabella!

  • @mbaochachigozie1785
    @mbaochachigozie1785 17 วันที่ผ่านมา

    I want to ask if you hve a course on nodejs? You simplify things alot and I am loving it

  • @JohnMcclaned
    @JohnMcclaned 11 หลายเดือนก่อน +3

    Thanks for the interesting video, would be great to also see how to use Ably in my projects too.

    • @AblyRealtime
      @AblyRealtime  11 หลายเดือนก่อน +1

      Thanks for the kind words John, we're working on more videos so stay tuned 😎

  • @ahmedshawky8274
    @ahmedshawky8274 26 วันที่ผ่านมา

    amazing video this legit a gift from the youtube recomndations

  • @rickshawty
    @rickshawty 5 หลายเดือนก่อน +1

    Thanks for the tutorial, I really appreciate the effort. One q tho, r u rly using white mode in vs code?

    • @AblyRealtime
      @AblyRealtime  5 หลายเดือนก่อน +1

      Alex is just a VS code white-mode kinda guy 😎

  • @Sbz-i2c
    @Sbz-i2c 9 หลายเดือนก่อน +1

    Many thanks ! Would also love to see how to implement Ably websockets in a Next.JS app :)

    • @AblyRealtime
      @AblyRealtime  9 หลายเดือนก่อน +1

      Thanks for letting us know, a great suggestion!

  • @anmarm.9487
    @anmarm.9487 3 วันที่ผ่านมา

    What theme are you using. Great tutorial by the way, just wandering why you avoided using SocketIO?

    • @AblyRealtime
      @AblyRealtime  42 นาทีที่ผ่านมา

      Hey there! It is github light theme, and no reason to avoid SocketIO. The react-use-websocket has experimental SocketIO support now as well if needed

  • @kishankumar-ze5pf
    @kishankumar-ze5pf 4 หลายเดือนก่อน

    thank u buddy for creating this awsm content , easy to understand thanks again

    • @AblyRealtime
      @AblyRealtime  4 หลายเดือนก่อน

      Thanks for commenting!

  • @nxone9903
    @nxone9903 6 หลายเดือนก่อน

    Underrated channel.

  • @incidentallygeeks
    @incidentallygeeks 9 หลายเดือนก่อน +3

    You the man!

  • @beingmyself3706
    @beingmyself3706 6 หลายเดือนก่อน

    Extremely useful, easy to understand, perfect ^)

  • @StudioShop
    @StudioShop 5 หลายเดือนก่อน

    Thanks for a great tutorial. Appreciate it.

  • @wushupro
    @wushupro 10 หลายเดือนก่อน +1

    Awesome tutorial! I think I’m missing something. You’ve added useref to stop it rerendering but why does it re render so much in the first place? I thought react components only re render if state or props change?

    • @AblyRealtime
      @AblyRealtime  10 หลายเดือนก่อน

      React useWebSocket forces a render when lastJsonMessage is updated. In other words, the component renders every time a new WebSocket message is received - Alex

  • @hlibtumakov4367
    @hlibtumakov4367 10 หลายเดือนก่อน +2

    Since Node v.15.6.0 you don't need to install `uuid` from npm. There is a Node's native module called 'node:crypto' which exports 'randomUUID` (UUID v4) function.

    • @AblyRealtime
      @AblyRealtime  10 หลายเดือนก่อน +1

      Thanks, will feed this back to the team.

  • @wangyanzhao8475
    @wangyanzhao8475 8 วันที่ผ่านมา

    Why do you have two http servers running? One is for the handshake of websocket, the other is launched from vite for react frontend.
    Is this the correct way to handle the websocket?

  • @justiceessiel6123
    @justiceessiel6123 10 หลายเดือนก่อน +1

    Are the hackthon projects repos available want to do sth close to uber so if there is a blog on that as well or a video that be created with react or react native that would be great

    • @AblyRealtime
      @AblyRealtime  10 หลายเดือนก่อน

      Hello, you can find the hackathon project gallery at ably.devpost.com/project-gallery but the repos may not be public.

  • @nibunimu
    @nibunimu 10 หลายเดือนก่อน +2

    Why do we use useRef and not useCallback at 57:00?

    • @AblyRealtime
      @AblyRealtime  10 หลายเดือนก่อน

      Good question. To the best of my understanding, useRef is equivalent to useCallback with an empty dependencies array. They both accomplish the same thing, which is to reference a variable between re-renders - Alex

  • @Goku-xm1gq
    @Goku-xm1gq 10 หลายเดือนก่อน +1

    You said brodcasting using loop ? but that aint feasible right ? when user count is high

    • @AblyRealtime
      @AblyRealtime  10 หลายเดือนก่อน

      Correct - when the user count is extremely high, broadcasting a message to every single client using a loop can lead to performance issues. In such cases, more complex solutions such as pub/sub models or a Message Queue system might be needed. These solutions allow the server to handle a much larger number of connections simultaneously. - Alex

  • @GriffynGould
    @GriffynGould 9 หลายเดือนก่อน +1

    10/10

    • @AblyRealtime
      @AblyRealtime  9 หลายเดือนก่อน

      Thanks! Glad to hear you liked it!

  • @ihateorangecat
    @ihateorangecat 8 หลายเดือนก่อน

    Such a quality content there! 👍
    Websocket has been overwhelming for me as a socket io user, and this expalins a very decent way love it.
    I really hope to see more educational contents like this from this channel and alst but not least Ably looks really interesting to give a try too!

  • @AbdurRahim-eu3zr
    @AbdurRahim-eu3zr 10 หลายเดือนก่อน +4

    Using light theme is like bringing a flashlight to a laser show - let's keep it dark and mysterious, shall we?

    • @AblyRealtime
      @AblyRealtime  10 หลายเดือนก่อน

      Thanks for your feedback, we will keep it in mind for future videos.

    • @keyonlewis7574
      @keyonlewis7574 10 หลายเดือนก่อน

      ​@@AblyRealtimeyes that would be nice

  • @enriqueMota
    @enriqueMota 18 วันที่ผ่านมา

    Light mode is crazy

  • @milon27
    @milon27 11 หลายเดือนก่อน +1

    🎉 how to deploy properly ? in scalable way

    • @AblyRealtime
      @AblyRealtime  10 หลายเดือนก่อน

      Hello, we have another recent video called 'How to scale WebSockets to millions of connections' which you might find helpful: th-cam.com/video/vXJsJ52vwAA/w-d-xo.html - let us know if you have any questions

  • @sandipsarkar1702
    @sandipsarkar1702 5 หลายเดือนก่อน +1

    could you please use dark theme! 😅

    • @AblyRealtime
      @AblyRealtime  5 หลายเดือนก่อน

      we will next time 🥰

  • @eddieaguilar4878
    @eddieaguilar4878 8 หลายเดือนก่อน

    Awesome thing but my eyes are crying with this light IDE 😂

  • @arifulislamleeton
    @arifulislamleeton 8 หลายเดือนก่อน +1

    Hi I'm Ariful Islam leeton im software developer and website developer and co founder open A. I

  • @NoNamePerson18
    @NoNamePerson18 6 หลายเดือนก่อน

    This guy is a monster, a psychopath, he uses light theme,