Asp.Net Core WebSockets Vs SignalR. Which should you use? (Full Course)

Поделиться
HTML-код
  • Опубликовано: 27 июл 2019
  • In this video we build 2 separate chat applications, one using Asp.Net Core WebSockets and the other using SignalR, allowing you to compare approaches and decide on which one works best for you. In both cases we build them with C#, .NET Core and JavaScript. You’ll also learn about:
    - .NET Core Request Pipeline
    - Request Delegates
    - Asynchronous Programming in .NET (Async / Await)
    - Introduction to Dependency Injection
    - My Book: www.apress.com/gp/book/978148...
    A companion article, (including all links to all the mentioned references and articles), can be found at: dotnetplaybook.com/
    GEAR
    ----
    I created this video using the following gear, (which I paid for myself!):
    - My Camera: amzn.to/2W4ULRc
    - Wide Angle Lens: amzn.to/2FfEDGK
    - USB3 Docking Station: amzn.to/2T7T2IY
    - Memory Cards:amzn.to/2TKVLxf
    - Lavalier Mic: amzn.to/2FcfdbM
    - Video Editing: amzn.to/2FhKL1j
    - Productivity: amzn.to/2Ckywza
    Note: I may receive a small commission if you choose to buy something from Amazon after clicking any of the links above.
  • НаукаНаука

Комментарии • 149

  • @automatic241
    @automatic241 5 лет назад +138

    Simply no one does all this for free, thank you for your work

    • @binarythistle
      @binarythistle  5 лет назад +36

      No worries, it's my pleasure!

    • @manyayao8103
      @manyayao8103 2 года назад

      would it be ok to ask you: if you could share the source code ?

  • @stupiddoeswow
    @stupiddoeswow 4 года назад +4

    Fantastic video. It's exactly what I was looking for. Watched it start to finish and I learned tons. Thanks so much dude! :)

  • @babanmalhi6168
    @babanmalhi6168 3 года назад +1

    This video was very very long but it worth watching every second of it. Thank you so much and god bless you! Thank you for taking so many hours from your schedule to teach us all.

  • @giorgilomtadze8600
    @giorgilomtadze8600 2 года назад +1

    Huge respect, usually I don't comment on any tutorials, but the knowledge of the topic and details is astonishing! Well done lad!

  • @nielsciezkowski5649
    @nielsciezkowski5649 4 года назад +1

    A long video but worth every minute of my time! Thanks for this enlightening video!!

  • @GeorgiMarokov
    @GeorgiMarokov 3 года назад +3

    That was fantastic tutorial! Thanks for that. Keep up with the good work!

  • @DRFFredy
    @DRFFredy 3 года назад +4

    I enjoyed the tutorial and learned a lot. Thank you for sharing your knowledge and for spending all the time needed to make this tutorial (research, live coding and speaking, video editing, etc).
    May the universe bless you Les!!

  • @pinwanrj
    @pinwanrj 3 года назад +1

    That's a fantastic job, Jackson. Congrats!!!

  • @Radwinskee
    @Radwinskee 4 года назад

    This is an AWESOME tutorial. I love the way you explain each line of code after you manually type it in and the way you explain other concept that was needed in this tutorial like the "Async and Await". I think you would be a really effective and fantastic teacher in a classroom. No offence but you are much much better than my professor in college. Thanks again and please continue helping other coders by your tutorials. - Your follower here in Canada.

  • @dpavlovsky
    @dpavlovsky 2 года назад

    You're a legend man. Thanks for the video. I'm getting into Websockets and SignalR right now and this helps a lot.

  • @nickguerra8460
    @nickguerra8460 4 года назад +1

    Great video Les. Love the style, love the info. Please keep up the good work, it is very much appreciated!!

    • @binarythistle
      @binarythistle  4 года назад

      Thanks Nick, best wishes from the "land down under"

  • @umeshhbhat
    @umeshhbhat Год назад

    Great content. Loved the DI and the configuration part for the middleware.

  • @kimaloshyn4754
    @kimaloshyn4754 2 года назад

    Incredible material. I really enjoyed every piece of the infomation you presented. Thank you!

  • @ta-cvig
    @ta-cvig Год назад

    I really needed this! Thanks for sharing Les. You Are Appreciated!!

  • @reymarkandog1441
    @reymarkandog1441 3 года назад

    Great Content man. Everything seems clear now.

  • @QuavePL
    @QuavePL 2 года назад

    I had watched few tutorials about making websocket application in .NET Core but I can't get how it works under until I found your video. Great job!

  • @chrismcclure4264
    @chrismcclure4264 3 года назад +24

    How does this not have more views? This is better than pay courses.

    • @elpiruwebmaster
      @elpiruwebmaster 2 года назад

      The best is it contains more than I expected.

  • @flygonfiasco9751
    @flygonfiasco9751 4 года назад +2

    Love that you didn’t just copy an paste code. Thank you for the tutorial!

  • @zulhishamtan4308
    @zulhishamtan4308 3 года назад

    A very prefect tutorial course.
    Awesome work.
    Thank you very much.

  • @tayannepaula
    @tayannepaula 4 года назад +3

    Thank You Les, your teaching is incredible! Best Regards from Brazil.. Obrigado!

  • @eykalgzr
    @eykalgzr 2 года назад

    This is awesome course man. Thanks!

  • @jak3f
    @jak3f 3 года назад

    what an amazing tutorial. Many thanks Les!

  • @VAcharya
    @VAcharya 4 года назад +1

    Awesome stuff!! Thank you very much. Loved it. Keep up your work.

  • @brendaescobar1024
    @brendaescobar1024 2 года назад

    Es el video mas educativo que encontré hasta ahora, muchísimas gracias por explicar, cuando estas empezando necesitas explicaciones lo mas profundas y complejas posibles, reitero, te lo super agradezco.

  • @bradrehman7964
    @bradrehman7964 3 года назад

    Great vids....Wish I had come by them even sooner...really enjoying your content.

  • @watershedmetal2
    @watershedmetal2 4 года назад +4

    This is the perfect style of teaching. Provides loads of information, all of which is on-topic, never wanders down any rabbit holes bloating the content but also never glosses over anything crucial to the full understanding of the subject. Clearly has a very high level of experience and willing to take the time to share. Thank you so much!

    • @binarythistle
      @binarythistle  4 года назад +2

      Thanks mate! This was a long one but I wanted to cover everything, (as you say), that was relevant. Thanks so much for taking the time to feedback, much appreciated, Les

    • @MobilTemp
      @MobilTemp 3 года назад

      Lmao I loved it too. Your comment is just right on bro.

  • @Sparklmonkey
    @Sparklmonkey 8 месяцев назад +1

    This is the second time I'm following this course. FIrst was about 2 years ago, and now I am refreshing my knowledge and cleaning up my old implementation of SIgnalR.
    I am actually using SignalR for a Unity game, to handle PvP in a card game.
    Really awesome tutorial, easy to follow but contains all the information you need! Top notch!!

    • @richardoteri9746
      @richardoteri9746 5 месяцев назад

      same came back to this after 2 plus years! amazing tutorial.

  • @multylife
    @multylife 2 года назад +1

    heeello Professor, the content of your course is simply sensational and saved me on a new journey (new job haha) thank you very much! I'm already your fan.
    Saalve Professor, o conteúdo do seu curso é simplesmente sensacional e me salvou numa nova jornada( novo emprego haha) muito obrigado! já sou seu fã.

  • @niall5447
    @niall5447 2 года назад

    I am 1.5 hours into this, thank you so much for this. Very easy to listen to and making so much sense. After this I might even shout for Scotland in Rugby (Probably not being irish)

  • @pablominjares4490
    @pablominjares4490 2 года назад

    Material is succinct and delivers on multiple layers. You're a true developer! Thanks for sharing your journey 😃

  • @Krepenzis
    @Krepenzis 2 года назад

    Greeting from Scotland! 😁
    Really good tutorial and great job, thanks! 👍👏

  • @FlorentBathily
    @FlorentBathily 3 года назад

    Realy thank's for your job you help me a lot ! big up from Africa

  • @husseinbeygi754
    @husseinbeygi754 3 года назад

    So much knowledge in 3h.thank you...

  • @abdelkrimbournane7332
    @abdelkrimbournane7332 3 года назад

    Great tutorial, thank you !!

  • @Bloodthirst
    @Bloodthirst 4 года назад +1

    as someone who is kind of new to .NET Core (coming from a Unity3D background) , this is was the best explanation i found of middlewares , just very clear and straight to the point. thnx for the high quality video

    • @binarythistle
      @binarythistle  4 года назад

      Awesome - thanks for the feedback mate.

  • @sheikmaideen5351
    @sheikmaideen5351 Год назад

    Thanks a lot. The tutorial is amazing.

  • @kombuchamp
    @kombuchamp 5 лет назад +7

    Thank you for your work!

  • @vahidrashidli5551
    @vahidrashidli5551 2 года назад

    Thank you! you helped me tremendously

  • @dchennaraidu
    @dchennaraidu 3 года назад

    Thank you Les!

  • @blip-hn6is
    @blip-hn6is 3 года назад

    thanks bro it helped me so much. its really hard upgrading systems that old signalr .net framework to .net core

  • @govindkarthikeyan
    @govindkarthikeyan 3 года назад

    First thanks for sharing such a valuable content for free, next thanks for spending more than 3 hours of your valuable time and share all your knowledge with everyone. I never saw any paid content which explains clearly like you explained here. Thanks again.

  • @diegoforlan2568
    @diegoforlan2568 3 года назад +2

    my english listening level is very bad. but i am listening this man,even if i don't understand what he says :D

  • @user-nn4rv9cy1m
    @user-nn4rv9cy1m 2 года назад

    very useful
    thank you for your work

  • @Caldaron
    @Caldaron 3 года назад +1

    Thanks for this amazin tutorial Les, you rellay helped us out here ;-)

  • @DJosh-cs5vx
    @DJosh-cs5vx 2 года назад

    Thanks as always

  • @naveenpolasu4670
    @naveenpolasu4670 9 месяцев назад

    Really helpful.

  • @timothyboyd8551
    @timothyboyd8551 2 года назад

    Regarding letting you know how I received the long coding block of the WebSocketClient.html: I enjoyed following along and typing code after you. I believe this is the first html plus javascript document I have ever typed. I believe it will prove valuable experience for me. thank you.

  • @amineayachi335
    @amineayachi335 Год назад

    Thanks Les Jackson youre amazing

  • @haijiesggu8508
    @haijiesggu8508 Год назад

    HI Jackson, thanks for your video. do u have article or video about how to scale out the websockets.

  • @erokazen
    @erokazen 2 года назад +1

    You always say 60mins 😂
    Nd u end up with 3 hours
    Thank you so much 🙏🏽🌹

  • @neoan1
    @neoan1 2 года назад

    Quiet good saved me a lot of time and effort.

  • @abdelkrimbournane7332
    @abdelkrimbournane7332 3 года назад

    GONNA BUY YOUR BOOK!!

  • @diegoforlan2568
    @diegoforlan2568 3 года назад

    intro music is wonderfulll :D

  • @LornaKelso
    @LornaKelso 5 лет назад +3

    Thanks so much Les

    • @binarythistle
      @binarythistle  5 лет назад

      My pleasure hope it was useful!

    • @LornaKelso
      @LornaKelso 3 года назад

      @@binarythistle I've finally been given the go ahead to start in on this project in work so I started looking at your video. I'm about an hour in, and I'm starting to panic because nothing is making sense as regards my specific requirements! Do you discuss how to create a WebSocket client in C# in this video? Specifically using .NET framework? I am not building the server, I am just connecting to an existing websocket server which provides information from a telecoms provider.

  • @jakubdedio5421
    @jakubdedio5421 4 года назад

    Awesome!

  • @mustafacinar9153
    @mustafacinar9153 3 года назад

    Nice intro, i see you are a man of culture as well.

  • @vivekverma30494
    @vivekverma30494 3 года назад

    Thank You.

  • @bjamisetti
    @bjamisetti 4 года назад

    Very Helpful...Thank you very much..(Y)

  • @sachithwickramaarachchi9695
    @sachithwickramaarachchi9695 3 года назад

    Great video Sir

  • @BTimelessC
    @BTimelessC Год назад

    In the websocket implementation, I changed the Action delegate parameter of the ReceiveMessage method with a Func so I can control when to stop receiving in the while instead of just having while(socket.Status.Open),
    Do you think that my approach makes sense?
    edit: Great video by the way, really appreciated it

  • @rockey4474
    @rockey4474 5 лет назад +1

    Bro, Thanks to share.

  • @bijaysahoo9619
    @bijaysahoo9619 2 года назад

    Hey Les! One question. I couldn't figure out in WebSocket part, how the method "InvokeAsync" gets triggered. There is no reference to it.

  • @russellabraham9208
    @russellabraham9208 4 года назад

    Thank you

  • @pavolhlavac-pianist7916
    @pavolhlavac-pianist7916 2 года назад

    perfect!

  • @igorr4682
    @igorr4682 Год назад

    Can you provide the link to the background music ?

  • @goncalomenboss
    @goncalomenboss 4 года назад

    gotta love the sound transitions

  • @fatemehayoubi2020
    @fatemehayoubi2020 2 года назад

    It was so goooood! But I wish you save the chat in db

  • @everforexcanada5663
    @everforexcanada5663 Год назад

    wow such a great vid! thank you so much! I have enjoyed every single second of the video and learnt a lot! one humble request, could you make another vid when you free and explain how authentication, security and http session management work in a websocket or singlr web application? say login to a http page, and then do real work with all of the login credentials and session on another websocket server.

  • @felsonexe9061
    @felsonexe9061 3 года назад

    Its so a powerfull video

  • @kfathi1
    @kfathi1 Год назад

    very nice

  • @mabakoo
    @mabakoo 4 года назад

    Great tutor.. basics clearly explained. Can you explain signal r with a blazor server app ?

  • @DiddleDangle
    @DiddleDangle 4 года назад

    I actually really like that you did this in straight javascript because I think it's a lot easier to see what's going on.

  • @dfytq
    @dfytq Год назад

    You have showed how to communicate with chat hub. But what if I want to reach to the client from my service layer? For example if a user submit a request, after a few seconds I want to reach to him. In the chat hub there is no exposed method that allows to achieve that?

  • @saschah6399
    @saschah6399 3 года назад

    Great work. Really good explained. How could I now push something from the Server. So if I want to keep the connections open, do something in a thread. After my work is done. send something to the client.
    I did a singelton of the MiddleWare class, but that does not seam clean.
    Cheers

  • @nobytes2
    @nobytes2 3 года назад

    3:07:00 or so there is a SignalR interface, I did a SignalR cdn script import, and SignalR.ConnectionState.Disconnected all the states are there.

  • @jRQLME
    @jRQLME 3 года назад

    AMAZING

  • @alexandermeeus2554
    @alexandermeeus2554 3 года назад

    Thanks again, Mr. Jackson.
    Ps: 'Les' means 'Lesson' in dutch :)

  • @amirmossapour2278
    @amirmossapour2278 4 года назад +1

    Thank you for your work! متشکرم

  • @asharnavya
    @asharnavya 2 года назад

    I am proud that I am a student of yours.... Where you were for the last 8 years...? :)

  • @Dennis19901
    @Dennis19901 2 года назад

    Feels like all of the boilerplating that you wrote/have to write for Websockets is already present in SignalR.
    That alone seems like a major benefit, at the very least for small projects/prototyping.

  • @rosmuhammad5089
    @rosmuhammad5089 Год назад

    im on minutes 55 now on websocket. i am never this invested in a youtube tutorial before 🤣

  • @Mortizul
    @Mortizul 5 лет назад +1

    The intro track makes me think of a slowed down version of "Geography 1" by Front 242. I prefer the sped-up version of you writing code to a cut & paste approach.

    • @binarythistle
      @binarythistle  5 лет назад +3

      Hey Mortizul ! I'll check out Front 242 - they look right up my street! Yeah I think a musical interlude can work well if the music is ok. Also I quite like showing the mistakes I make, it makes it more real than just copy/pasting correct code. Appreciate the feedback, Cheers, Les

  • @TheVlad3333
    @TheVlad3333 4 года назад +1

    thank you

  • @rukshanpokharel6841
    @rukshanpokharel6841 4 года назад

    hello les I really need your help here...can you provide how to do this exact same things in asp .net mvc web api.. this is for .net core and i am doing my project in web api.. if you provide me how to do the signalR in web api it would be a big help for me ..

  • @kennethgee2004
    @kennethgee2004 2 года назад

    Well this is two years old now and Microsoft has answered that question for us. It is SignalR as that is what is being used with Blazor

  • @DevOpsHasan
    @DevOpsHasan 2 года назад

    Please create a video on webRTC with signalR directly use in asp core without node+express+socketIo

  • @abdelkrimbournane7332
    @abdelkrimbournane7332 3 года назад +3

    In a nutshell, why you should use SignalR over Websockets.
    Websockets part : 2h30min
    SignalR part : 50 min.

  • @henrygu6149
    @henrygu6149 7 месяцев назад

    I would use SignalR. It saves lots lots of work of managing all the connections, when we need to consider of multiple browsers

  • @b1gboss
    @b1gboss 4 года назад

    Great video. One question, is it possible to create clients for the web socket that are not in a browser? Using .net.

    • @GeorgiMarokov
      @GeorgiMarokov 3 года назад

      Yes you can. There is a client for .NET which you can find in the docs.

  • @sergeyagajanov1597
    @sergeyagajanov1597 3 года назад

    Do you find SignalR useful when we speak about websocket-only integration between asp and native application like ios (swift) or android (kotlin/java)?
    I would not want to involve some sort of dependency of officially unsupported client-side signalR libraries for swift and java. And which more important would like to save some freedom to migrate websocket backend from asp to other platform, for example written in Golnag.
    For now it seems that client just need to support a little bit specific SignalR protocol json format , but maybe it's possible to customize this format. Or a better choice to give up with SignalR at all and use pure webSocket infrastructure like you provide in you lesson?

  • @zormax4817
    @zormax4817 Год назад +1

    At 1:15:10 - Why did you give the size of the byte array as 4096? Why 1024 * 4

    • @opticalmouse2
      @opticalmouse2 Год назад

      He doesn't know but I'll tell you. You can make it any size you'd like.
      Let's say you make it byte[2] instead of byte[1024 * 4] but when the server receives "Zor Max" only "Zo" is registered 'cause of byte[2].
      If I make it byte[3] the only "Zor" is registered.
      If I make it byte[[5] then only "Zor M" is registered. (5 including the space)
      Get it?

  • @WaterfallEnthusiast43
    @WaterfallEnthusiast43 Год назад

    I have no idea what any of this is. Came here from an Excel LBO modeling video but this was very interesting.

  • @chrisbaker5284
    @chrisbaker5284 2 года назад

    GetAllSockets() returns a dictionary so would it not be more efficient to do:
    var sock = _manager.GetAllSockets()[guidOutput.ToString()];
    if (sock != null)
    {...}

  • @baqoficial3767
    @baqoficial3767 3 года назад

    nice code over there excepting JS wich seems to be copied from Microsoft docs example. Anyway I really appreciate your work. I saw already many tutorials of websocket in diffrent programming languages and readed many docs about it but your video is just best like all in one.

  • @avimehenwal
    @avimehenwal 4 года назад +2

    Greetings from Germany XD Excellent video ... very generous. God bless you. I learnt a lot.
    I am working on a realtime app for RIM embedded system, would be using these leant skills for the project

  • @nathansimpson6619
    @nathansimpson6619 2 года назад

    So is it possible for me to develop the websocket code on a seperate server and allow multiple wordpress websites trigger it to give me real time comments, posts and functionality on wordpress sites... using same app to many sites? if so please let me know! :) awesome video - but above my head as i only tamper with html and css for most part.

  • @Al-SadmanChowdhury
    @Al-SadmanChowdhury 4 года назад

    i am having an issue while connocting @45:08 ..my error shows
    return str.toString()
    .replace(/&/g, '&')
    .replace(/"/g, '"')
    .replace(/'/g, ''')
    .replace(//g, '>');
    cannot read property toString..
    can anypne help??

    • @memenchomezov
      @memenchomezov 2 года назад

      make sure your Program.cs is like this (because in the video he showed only Startup.cs content) :
      using Microsoft.AspNetCore;
      namespace WebSocketServer
      {
      public class Program
      {
      public static void Main(string[] args)
      {
      CreateWebHostBuilder(args).Build().Run();
      }
      public static IWebHostBuilder CreateWebHostBuilder(string[] args) =>
      WebHost.CreateDefaultBuilder(args)
      .UseStartup();
      }

      }

  • @mohammedalmahdialjeafry8155
    @mohammedalmahdialjeafry8155 3 года назад

    WebSocket connection to 'ws://localhost:5000/' failed: Error in connection establishment: net::ERR_CONNECTION_REFUSED iam at 45.51 and i get this what is the cause of this error ?thanks for the video

  • @fatihk.2246
    @fatihk.2246 3 года назад

    in javascript, "htmlEscape(str)" str is null, so str.toString gives me error.

    • @memenchomezov
      @memenchomezov 2 года назад

      make sure your Program.cs is like this:
      using Microsoft.AspNetCore;
      namespace WebSocketServer
      {
      public class Program
      {
      public static void Main(string[] args)
      {
      CreateWebHostBuilder(args).Build().Run();
      }
      public static IWebHostBuilder CreateWebHostBuilder(string[] args) =>
      WebHost.CreateDefaultBuilder(args)
      .UseStartup();
      }

      }

  • @MdIrfan-ip9be
    @MdIrfan-ip9be 4 года назад

    Can we use SignalR on server side(.net core web api server) and on client side just normal JavaScript websocket api?

    • @GeorgiMarokov
      @GeorgiMarokov 3 года назад

      I think you can create your own client using Hubs protocol from SignalR.