Making A WebSocket Server With .NET 8🧑‍💻 [FULLSTACK 2024 VIDEO 1]

Sdílet
Vložit
  • čas přidán 29. 12. 2023
  • Source code: github.com/uldahlalex/ws/tree... (Link to exact source code by the end of the video)
    Preliminary knowledge:
    - Basic knowledge about Web and APIs
    - Basic C# knowledge
    - Basic CLI skills (shell commands like cd, mkdir, ls ...)
    - For making the small client app: Basic Angular knowledge
    TIMESTAMPS:
    00:00: What are WebSockets?
    02:08: .NET WebSocket Server
    06:32: WebSocket Communication
    09:42: Broadcasting Data
    11:54: WebSocket Client App
    17:48: Final product

Komentáře • 9

  • @oliverager7448
    @oliverager7448 Před 4 měsíci +1

    Great new video keep up the good work

  • @StackOverflowMan
    @StackOverflowMan Před 3 měsíci

    Why do you choose Flesk? Agree, API looks clearer than for System.Net.WebSockets, but maybe that abstraction level leaks?

  • @guillermomazzari8320
    @guillermomazzari8320 Před 3 měsíci

    Nice vid, could I stablish a ws connection to my database and update the Ui in real time when something changes in the database? for example, If I call data form a table of people, where I have john, Mary and Laura and I am seeing this list in my frontend ui, but someone else deletes Laura in another browser, will I see that change on my browser immediately? without having to refresh or make a new request to the data base?

    • @alexdevden
      @alexdevden  Před 3 měsíci +1

      Hey, thank you!
      There are DBMS's that support listening for database changes and can emit events for this use case. For instance, this repo: github.com/supabase/realtime uses Postgres and Websockets to achieve this effect.

    • @guillermomazzari8320
      @guillermomazzari8320 Před 3 měsíci

      @@alexdevden I was looking into signalR what are your thoughts on it?

    • @alexdevden
      @alexdevden  Před 3 měsíci +1

      SignalR doesn't use generic websockets since they try to "build on top of" websockets. That means you need a dedicated SignalR client. It's kind of the same deal with Socket.IO. I prefer to use open standards and protocols rather than technologies that lock you in to specific SDKs
      @@guillermomazzari8320

    • @guillermomazzari8320
      @guillermomazzari8320 Před 3 měsíci

      @@alexdevden Thanks for your answer! It is very helpful

  • @CodingByAmp
    @CodingByAmp Před 11 dny +1

    How to bordcast all client

    • @alexdevden
      @alexdevden  Před 8 dny

      In short, if you have a List connections, you can iterate over this list and send to each like this:
      foreach (var connection in connections)
      {
      var string = "hello world";
      connection.Send(message);
      }