How I Handle WebSockets in Web Apps | React, TypeScript & Effect

แชร์
ฝัง
  • เผยแพร่เมื่อ 12 ม.ค. 2025

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

  • @lucas-barake
    @lucas-barake  22 วันที่ผ่านมา +4

    35:07 Right after finishing the video, I noticed that the connectionAckLatch is a bit overkill. It's simpler to just define a function that takes in the connectionTimeout and registers the handlers - you can find the updated code in the description.

  • @fixer8173
    @fixer8173 21 วันที่ผ่านมา +1

    One of the most insightful Effect videos I've seen so far. Subscribed and liked, thanks for awesome job

    • @lucas-barake
      @lucas-barake  21 วันที่ผ่านมา

      Awesome, thank you!

  • @richardamare3575
    @richardamare3575 21 วันที่ผ่านมา

    Great video! I fell in love with Effect thanks to your videos. Thank you man!

    • @lucas-barake
      @lucas-barake  21 วันที่ผ่านมา

      Happy to hear that!

  • @epicentar789
    @epicentar789 21 วันที่ผ่านมา

    Awesome video, as always! Love your effect content

  • @Danielo515
    @Danielo515 19 วันที่ผ่านมา

    You make the best effect videos. Very direct to the point, explaining every concept, fixing concrete problems... Wow man, absolutely impressive.
    How much are you liking the new Service interface? To me it couples the type too much to one particular implementation, and to me the point of services and dependency injection is to be able to swap implementations. Also I find confusing that, by default, streams are recreated on every subscription.
    Keep up the good work

    • @lucas-barake
      @lucas-barake  18 วันที่ผ่านมา

      Thanks so much!
      I'm really liking Service. Removes a lot of the boilerplate. But from what I can see, the general consensus is:
      - Effect.Service if you need a primary implementation
      - Context.Tag for multiple implementations that don't need a default implementation (like the use case you pointed out)
      As for streams, it makes sense. Streams being recreated by default gives you pure functional composition. After all, each pipeline represents a blueprint of operations, not a shared execution - a source without a Stream.share is just a piece to expand from.
      Stream.merge might suggest sharing, but each brand represents an independent processing pipeline. I suppose merging simply describes how to combine outputs, not how to manage the source.

  • @byailen
    @byailen 22 วันที่ผ่านมา +1

    Good work man

  • @khalilbenachir2135
    @khalilbenachir2135 19 วันที่ผ่านมา

    Great video! I discovered my love for Effect thanks to your content. Appreciate it, man! Could you guide me on where to find more resources about Effect?

    • @lucas-barake
      @lucas-barake  18 วันที่ผ่านมา

      Thanks! I'll be releasing a course on Effect soon. In the meantime, you can check out my other videos. I recommend taking a look at public repositories too - there are plenty available in the official Discord.

  • @Danielo515
    @Danielo515 19 วันที่ผ่านมา

    21:17 I don't understand how failing on the Ack stream will make everything retry, including re-creating the websocket connection

    • @lucas-barake
      @lucas-barake  18 วันที่ผ่านมา

      It uses timeoutFail which fails with a Cause.TimeoutException. This error gets propagated and caught by the parent fiber with the retry policy: effect.website/play#0f5938930086

    • @lucas-barake
      @lucas-barake  18 วันที่ผ่านมา

      Oh, just realized you were asking about the "connection_ack" one. At that point, it won't be retried, clearly... Haha. That policy is added here: 38:24

  • @bwsstha8864
    @bwsstha8864 7 วันที่ผ่านมา

    Can we Please have this version of web socket in react best practice using "zod" instead of "effect" as It would be informative for the masses. I don't have knowledge about effect. By the way loved your content.

    • @lucas-barake
      @lucas-barake  3 วันที่ผ่านมา

      Effect handles all this very elegantly. Building it without would mean more code, more edge cases, and more headaches. Not really worth it.

  • @Deus-lo-Vuilt
    @Deus-lo-Vuilt 21 วันที่ผ่านมา

    wow Nice!