I Wrote Websockets "From Scratch"

Ғылым және технология

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

  • @friedpizza262
    @friedpizza26215 күн бұрын

    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

    15 күн бұрын

    @@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!

  • @MetalManiacBoy
    @MetalManiacBoy15 күн бұрын

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

  • @sushidotggg
    @sushidotggg14 күн бұрын

    Your YT header made me chuckle. Great vids man

  • @zaj5924
    @zaj592415 күн бұрын

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

  • @RahulPatil-vz6hc
    @RahulPatil-vz6hc16 күн бұрын

    thanks sir for taking efforts and bringing such good contents.

  • @ebmpinyuri
    @ebmpinyuri15 күн бұрын

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

  • @LeonardoSantos-lp9hp
    @LeonardoSantos-lp9hp16 күн бұрын

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

  • @SanjayB-vy4gx
    @SanjayB-vy4gx16 күн бұрын

    great content man looking forward for more videos🥳

  • @marufhasan9365
    @marufhasan936515 күн бұрын

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

  • @EmmanuelOloyede
    @EmmanuelOloyede14 күн бұрын

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

  • @Dr.RasheleShoun
    @Dr.RasheleShoun13 күн бұрын

    This is awesome! ❤

  • @N0RT0X
    @N0RT0X16 күн бұрын

    underrated channel 🔥

  • @juliusherbert709

    @juliusherbert709

    16 күн бұрын

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

  • @eablot8592
    @eablot859214 күн бұрын

    Here cos of Ludwig. Subscribed. All the best.

  • @etnikg1659
    @etnikg165913 күн бұрын

    Keep Going 🔥🔥

  • @blvckbytes7329
    @blvckbytes73299 күн бұрын

    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

    9 күн бұрын

    @@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

    9 күн бұрын

    @@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.

  • @nigelhungerford-symes5059
    @nigelhungerford-symes505915 күн бұрын

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

  • @reydiansy6774
    @reydiansy677416 күн бұрын

    Great video

  • @mariusj8542
    @mariusj854214 күн бұрын

    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
    @briandepazdiaz15 күн бұрын

    excellent video! subscribing

  • @abrarmasumabir3809
    @abrarmasumabir380915 күн бұрын

    Bro I just subscribed!

  • @wargnema
    @wargnema15 күн бұрын

    thanks for a great video

  • @Coder.tahsin
    @Coder.tahsin16 күн бұрын

    great video

  • @heydarbadirli
    @heydarbadirli15 күн бұрын

    You can use Adobe Podcast to enhance the audio

  • @yashkumarkasaudhan1354
    @yashkumarkasaudhan135416 күн бұрын

    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

    16 күн бұрын

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

  • @greyshopleskin2315

    @greyshopleskin2315

    14 күн бұрын

    @@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 :)

  • @nosh3019
    @nosh301914 күн бұрын

    dude! 🤩

  • @conandoyle1859
    @conandoyle185915 күн бұрын

    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

    15 күн бұрын

    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.

  • @emretekin-x8b
    @emretekin-x8b15 күн бұрын

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

  • @vbhvx7
    @vbhvx715 күн бұрын

    kino. liked and subscribed

  • @majvax
    @majvax15 күн бұрын

    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

  • @6ugs6unny
    @6ugs6unny15 күн бұрын

    Amazing truly great work.

  • @stasgavrylov
    @stasgavrylov15 күн бұрын

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

  • @seanbix5366

    @seanbix5366

    15 күн бұрын

    @@stasgavrylov of course 🤝

  • @rajmajumdar5253
    @rajmajumdar525316 күн бұрын

    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

    16 күн бұрын

    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 🤜

  • @ckpioo
    @ckpioo15 күн бұрын

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

  • @seanbix5366

    @seanbix5366

    15 күн бұрын

    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

  • @axisaligned9799
    @axisaligned979915 күн бұрын

    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

    15 күн бұрын

    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!

  • @timemanager3239
    @timemanager323915 күн бұрын

    Thanks

  • @mohammedgoder
    @mohammedgoder15 күн бұрын

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

  • @seanbix5366

    @seanbix5366

    15 күн бұрын

    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

    15 күн бұрын

    ​@@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.

  • @raunak51299
    @raunak5129915 күн бұрын

    Great video! what distro r u using anyways?

  • @seanbix5366

    @seanbix5366

    15 күн бұрын

    @@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

    14 күн бұрын

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

  • @siyaram2855
    @siyaram285515 күн бұрын

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

  • @seanbix5366

    @seanbix5366

    15 күн бұрын

    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

    14 күн бұрын

    Thanks for responding

  • @yobeidni
    @yobeidni10 күн бұрын

    app used for whiteboarding?

  • @ratchetdoggo2224
    @ratchetdoggo222415 күн бұрын

    #based

  • @user-qh5bp2tg4l
    @user-qh5bp2tg4l14 күн бұрын

    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

    13 күн бұрын

    @@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

    13 күн бұрын

    @@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-dy4ed15 күн бұрын

    Make video about your vim setup

  • @seanbix5366

    @seanbix5366

    15 күн бұрын

    @@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
    @damianradinoiu431416 күн бұрын

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

  • @seanbix5366

    @seanbix5366

    16 күн бұрын

    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_roy15 күн бұрын

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

  • @seanbix5366

    @seanbix5366

    15 күн бұрын

    @@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

    15 күн бұрын

    ​​​@@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

    15 күн бұрын

    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

    15 күн бұрын

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

  • @yuvrajkukreja1248
    @yuvrajkukreja124815 күн бұрын

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

  • @seanbix5366

    @seanbix5366

    15 күн бұрын

    @@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

    15 күн бұрын

    What kind of criticism is that.

  • @tiranito2834

    @tiranito2834

    15 күн бұрын

    @@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

    14 күн бұрын

    ​@@tiranito2834ikr

  • @emretekin-x8b
    @emretekin-x8b15 күн бұрын

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

  • @seanbix5366

    @seanbix5366

    15 күн бұрын

    @@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!

Келесі