I Wrote Websockets "From Scratch"

Поділитися
Вставка
  • Опубліковано 6 лип 2024
  • Real-time, bi-directional TCP in the browser.
    I explain how Websocket protocol works down to every byte,
    and show it in action.
    Note this is HTTP 1.1, but should be similar enough for
    HTTP 2 and 3.
    I also mention TLS/SSL!
    Project Link: github.com/Bixkitts/relic-mer...
    Docs: developer.mozilla.org/en-US/d...
    HTTP & OSI Video I Made Prior: • I Wrote HTTP "From Scr...
  • Наука та технологія

КОМЕНТАРІ • 76

  • @MetalManiacBoy
    @MetalManiacBoy 14 днів тому +26

    Finally someone demystifies TCP/IP and other protocols! My itch has been scratched

  • @friedpizza262
    @friedpizza262 14 днів тому +25

    I though the video was just a highlight, cause instinctively you'd think implementing web-sockets protocol yourself is a crazy thought. I wouldn't have been brave enough to think it can be anything but painful!

    • @seanbix5366
      @seanbix5366  14 днів тому +5

      @@friedpizza262 yeah I initially gave up when trying to find a usable C/C++ library for this years ago, only thought to look into it again recently.
      Didn't even cross my mind to implement it but I found myself looking up the standard anyways and well, profit.
      There's typically a life saving difference between a working implementation and a complete implementation of anything, so never dismiss just writing the 10% you need personally!

  • @sushidotggg
    @sushidotggg 13 днів тому

    Your YT header made me chuckle. Great vids man

  • @zaj5924
    @zaj5924 14 днів тому +2

    awesome vid man, insta-subbed. excited to see more makeup tutorials in the future!

  • @LeonardoSantos-lp9hp
    @LeonardoSantos-lp9hp 15 днів тому +1

    Great content! Liked and subbed. Keep it up!!

  • @SanjayB-vy4gx
    @SanjayB-vy4gx 15 днів тому

    great content man looking forward for more videos🥳

  • @RahulPatil-vz6hc
    @RahulPatil-vz6hc 14 днів тому

    thanks sir for taking efforts and bringing such good contents.

  • @EmmanuelOloyede
    @EmmanuelOloyede 13 днів тому

    Beautiful. Also saw your video on http, I'm subscribing now.
    Great content!

  • @eablot8592
    @eablot8592 13 днів тому

    Here cos of Ludwig. Subscribed. All the best.

  • @etnikg1659
    @etnikg1659 12 днів тому +1

    Keep Going 🔥🔥

  • @ebmpinyuri
    @ebmpinyuri 14 днів тому

    Thank you so much very informative , definitely subscribed to this channel instantly

  • @marufhasan9365
    @marufhasan9365 14 днів тому +1

    I would love a video on your overall set up, preferably with better audio quality. Keep up the good work.

  • @N0RT0X
    @N0RT0X 15 днів тому +4

    underrated channel 🔥

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

      it will evolve! Just a matter of time! Thank u Sir for this invaluable source of deep knowledge!

  • @Dr.RasheleShoun
    @Dr.RasheleShoun 12 днів тому

    This is awesome! ❤

  • @abrarmasumabir3809
    @abrarmasumabir3809 13 днів тому

    Bro I just subscribed!

  • @reydiansy6774
    @reydiansy6774 14 днів тому +2

    Great video

  • @nigelhungerford-symes5059
    @nigelhungerford-symes5059 13 днів тому

    Very cool. C is a great tool for the job.

  • @mariusj8542
    @mariusj8542 13 днів тому

    Cudos on this project and the way you went through the code. I work a lot with both axios websockets in js and asyncio in python. But i needed to write a “websocket” for an stm32 processor just a few weeks back which i wrote in C++ as you do, too bad i did not know about your work. Since i just needed to solve much of the same problem you solved, full duplex and an efficient way of doing handshakes, with minimal headersize. I just “Jerry rigged” a poor mans version, but not as your good as your work. Nicely done!

  • @briandepazdiaz
    @briandepazdiaz 14 днів тому

    excellent video! subscribing

  • @blvckbytes7329
    @blvckbytes7329 8 днів тому

    Thank you very much for encouraging me to roll my own websocket code! My situation is that I am working on embedded devices, where I connect to the internet over either WiFi or Ethernet, and use chips like the ESP8266 or the ATmega328P, and need realtime communication to accept commands and synchronize state between multiple clients via events. Various existing libraries are an overly complicated mess of multiple layers of abstraction, next to hundreds of preprocessor macros, due to all kinds of hardware permutations - needless clutter, and heavy use of the std-lib. My little project will be up in no time, now that I can write application-specific code! :))

    • @seanbix5366
      @seanbix5366  8 днів тому +1

      @@blvckbytes7329 Right on!
      That _is_ how it do be.
      Do it, and thanks for watching!
      I was considering making a video about setting up the AVR compiler toolchain, and/or the arduino CLI, as I see professionals still using the Arduino IDE for chips like the ATmega328P (which I've specifically worked with recently!).

    • @blvckbytes7329
      @blvckbytes7329 8 днів тому

      @@seanbix5366 Right? I've read another comment of yours, where you said how people just use things without any understanding of their underlying working principles whatsoever; if society ever collapsed, only very few would know how to rebuild technology from scratch... Same goes for mathematics, but that's a whole other can of worms, ;).
      I'm just so disappointed at how needlessly complicated simple things became by now. All I want to do is to control a few I/O-lines using a browser via Ethernet, and I'm literally wrangling with dozens of libraries and build-errors since multiple hours. By now, I could've written the library myself, haha - which is what I am now doing! :)
      Would love to see that video about AVR programming. I am currently using PlatformIO, because it "just works" (most of the time, if VSCode isn't bug-riddled again). The Arduino "IDE" lacks too many critical features to get anything beyond a blinking LED done, at least IMHO.

  • @Coder.tahsin
    @Coder.tahsin 15 днів тому +1

    great video

  • @wargnema
    @wargnema 14 днів тому

    thanks for a great video

  • @emretekin-x8b
    @emretekin-x8b 14 днів тому

    Could you make a video on implementing "RTSP from scratch" ?

  • @vbhvx7
    @vbhvx7 14 днів тому

    kino.
    liked and subscribed

  • @heydarbadirli
    @heydarbadirli 14 днів тому +1

    You can use Adobe Podcast to enhance the audio

  • @nosh3019
    @nosh3019 13 днів тому

    dude! 🤩

  • @majvax
    @majvax 13 днів тому

    I did somewhat the same but using windows api was harsh to do honestly since I didn't have any experiences in this field but It's verh informative

  • @yashkumarkasaudhan1354
    @yashkumarkasaudhan1354 14 днів тому +5

    great video but could you please work on the audio. i have to use earphone to clearly understand that. because managing subtitle, audio, and content of video all of this becomes complex.

    • @seanbix5366
      @seanbix5366  14 днів тому

      @@yashkumarkasaudhan1354 I noise filter and compress the audio to make the words clearer, but I just have a crummy hardware set up 🤷

    • @greyshopleskin2315
      @greyshopleskin2315 13 днів тому

      @@seanbix5366i don’t know your hw setup, so can’t give specific advice. I guess the problem is not your mic?
      If fixing your setup is hard or expensive and want to fix your audio, maybe you could just use your phone to record audio and then add it to the video.
      Microphones of phones aren’t the best, but it will probably be good enough :)

  • @timemanager3239
    @timemanager3239 14 днів тому

    Thanks

  • @axisaligned9799
    @axisaligned9799 14 днів тому +2

    http & (ws) websockets are approachable & implementable by most. but man, https and wss (TLS/SSL) is where it becomes a pain in the ass lol. hand-implementing TLS is a nightmare. still doable but the random math cipher-suites to implement is tedious

    • @seanbix5366
      @seanbix5366  14 днів тому +1

      I was tempted to try, but just learning a library for this seemed like a useful enough skill on its own.
      I don't trust myself to make something secure enough for this particular project, but I'd love to try in future!

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

    app used for whiteboarding?

  • @6ugs6unny
    @6ugs6unny 14 днів тому

    Amazing truly great work.

  • @stasgavrylov
    @stasgavrylov 14 днів тому

    Great video, thank you. If possible, could you make the font size a tad larger next time? 🙏

    • @seanbix5366
      @seanbix5366  14 днів тому

      @@stasgavrylov of course 🤝

  • @ckpioo
    @ckpioo 14 днів тому

    amazing, btw what kind of game are you making this for?

    • @seanbix5366
      @seanbix5366  14 днів тому

      Thank you!
      Multiplayer digital board game, made to be a faster/better/custom clone of a game my friends and I play!
      I really need a frontend guy, JS is brain rot :c

  • @conandoyle1859
    @conandoyle1859 14 днів тому

    You know, all these modern development frameworks hide a lot of relatively low-level code that is necessary to understand how your application works. I am a Java programmer and we have this Spring framework, with the help of which you can develop WEB apps and much more. When I wanted to use websocket it was quite simple, you only had to write a couple of lines of code and Spring would do the rest for you, but if you want to do something more complicated than the basic example and from the first article of the official documentation, then you have difficulties. And the point is not that you don’t know the framework well, the point is that you don’t know the basics of the WebSocket technology used. Then I started with the basics - I wrote a simple http server with the functionality I needed, I used only the standard java library. Then I implemented the webSocket protocol and then everything fell into place! All the questions I had are gone! Everything turned out to be so simple!
    The problem with modern programmers is that we write very high-level code and do not understand it, since we do not know the basics, which are not taught in universities

    • @seanbix5366
      @seanbix5366  14 днів тому

      Try and start from the bottom up I say!
      How can you drive a car when you don't know how the wheels turn?
      Doable, but definitely worse.
      Thank you for the insight.

  • @mohammedgoder
    @mohammedgoder 14 днів тому

    Hey, great video on WebSocket.
    Could you make one on WebTransport?

    • @seanbix5366
      @seanbix5366  14 днів тому

      Oh that exists?
      Dope and thank you.
      When (and if...) my project is finished I'll definitely consider migrating to http3 and WebTransport (and documenting it here of course).
      Sounds like agony/fun

    • @mohammedgoder
      @mohammedgoder 14 днів тому

      ​@@seanbix5366 To be honest; I don't like webdev stuff.
      So I wanted to pawn off the work of parsing through the garbage in the published material to conjure up a working prototype.
      It's probably gonna be a painful endeavor.
      They really should allow devs to access raw UDP sockets.

  • @siyaram2855
    @siyaram2855 14 днів тому

    Is C the only lang to do such things?
    Can't JS be used for such things? Just curious

    • @seanbix5366
      @seanbix5366  14 днів тому

      JS on the server side is one of the top 10 evils to befall mankind.
      That being said, yes sure!
      JS had high level interfaces for all of this functionality.
      The browser client featured in the video is written in JS!

    • @siyaram2855
      @siyaram2855 13 днів тому

      Thanks for responding

  • @rajmajumdar5253
    @rajmajumdar5253 14 днів тому

    Damn thats 🤩🤩🤩🤩🤩 , can you also do auth in C? Or maybe something like STUN and TURN servers and why do we need them in WebRTC.

    • @seanbix5366
      @seanbix5366  14 днів тому

      Server already features basic token authentication, but it is not very secure.
      I'll consider making a video about that when, and if, I harden it 🤜

  • @raunak51299
    @raunak51299 14 днів тому

    Great video! what distro r u using anyways?

    • @seanbix5366
      @seanbix5366  14 днів тому

      @@raunak51299 Plain old Arch.
      Has served me solidly as a desktop OS for years now. Always get the latest updates and literally everything ever is in the aur

    • @raunak51299
      @raunak51299 13 днів тому

      ​@@seanbix5366maybe someday I'll be brave enough to switch to arch.

  • @ratchetdoggo2224
    @ratchetdoggo2224 14 днів тому

    #based

  • @user-qh5bp2tg4l
    @user-qh5bp2tg4l 12 днів тому

    weird seeing actual devs that sees this as witchcraft, you got to understande how to build everything from scratch. imagine if humanity rebooted and we can't even build internet again.

    • @seanbix5366
      @seanbix5366  12 днів тому +2

      @@user-qh5bp2tg4l I'm just a lowly IT dude with some curiosity.
      However, one of the first things that was imparted to me when I entered the field was "The bits and bytes don't matter, just remember this button sequence".
      People are happy to push a few buttons and collect a salary, even if an empty ROM is a few thousand bytes away from being a profitable system.
      And that's okay! But I don't envy the confusion they must feel, nor the reliance on a massive proprietary system to "just work"...

    • @user-qh5bp2tg4l
      @user-qh5bp2tg4l 12 днів тому

      @@seanbix5366 "even if an empty ROM is a few thousand bytes away from being a profitable system." this quote express how the IT industry enslaves the worker on developing based on someone's low level work.
      "even if an empty ROM is a few thousand bytes away from being a profitable system." can you elaborate on this?

  • @RespectTheResearch-dy4ed
    @RespectTheResearch-dy4ed 14 днів тому

    Make video about your vim setup

    • @seanbix5366
      @seanbix5366  14 днів тому

      @@RespectTheResearch-dy4ed Might be worth it. I dislike just downloading someone else's configuration for fear of it breaking when I simply want to write something.
      I meticulously picked and configured everything myself!

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

    Could you make a video on implementing "TCP from scratch" ?

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

      If I were to go to the trouble to implement a transport layer protocol for x86_64, it would be QUIC over UDP!
      I'll need to if I switch to http 3.
      I may need to do TCP for a microcontroller however, so if that happens, I'll make a video about it.

  • @sankhadip_roy
    @sankhadip_roy 14 днів тому

    Just coded it in computer network lab not that much complex though

    • @seanbix5366
      @seanbix5366  14 днів тому +1

      @@sankhadip_roy True. Seems obvious to those that know of course, but as an outsider looking in trying to grasp networking i can imagine it's a bit cryptic!

    • @sankhadip_roy
      @sankhadip_roy 14 днів тому

      ​​​@@seanbix5366Yea, that's right.
      As an cs student it seems familiar but for an outsider from a non tech field its horrible.
      I was also little panicking if this comes in my network lab semester exam. Got the cyclic redundancy checking code instead.

    • @sankhadip_roy
      @sankhadip_roy 14 днів тому

      After seeing this type of video getting good amount of view. I am in guilt why I didn't make a video on this when I was in the previous semester.

    • @seanbix5366
      @seanbix5366  14 днів тому

      CRC is definitely more practical to know how to write anyways!
      Good luck!

  • @yuvrajkukreja1248
    @yuvrajkukreja1248 14 днів тому +1

    I am a visual learner however I did not liked the slow pase and boring accent 😞

    • @seanbix5366
      @seanbix5366  14 днів тому

      @@yuvrajkukreja1248 I prefer the term "methodical" :( ... The linked document and websocket RFC itself are very approachable compared to other ones I've read, so you'll also get a good explanation straight from the source!

    • @raunak51299
      @raunak51299 14 днів тому +1

      What kind of criticism is that.

    • @tiranito2834
      @tiranito2834 14 днів тому

      @@raunak51299 The kind of criticism that should be ignored. "I don't like your video because you actually teach, waaa waaaa, my short attention span cannot handle this!!!" is all I heard when I read the comment lol.

    • @raunak51299
      @raunak51299 13 днів тому

      ​@@tiranito2834ikr

  • @emretekin-x8b
    @emretekin-x8b 14 днів тому

    Could you make a video on implementing "RTSP from scratch" ?

    • @seanbix5366
      @seanbix5366  14 днів тому +1

      @@emretekin-x8b I didn't know what that was, but now I see.
      If I encounter it in my career, I'll consider it thank you!