Mastering WebSockets With Go - An in-depth tutorial

แชร์
ฝัง
  • เผยแพร่เมื่อ 11 ต.ค. 2024

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

  • @IvanRandomDude
    @IvanRandomDude ปีที่แล้ว +18

    Great time to watch the tutorial. Gorilla toolkit was archived for the past 8 months. But 2 days ago it became active again after new maintainers took over. No better time to watch this.

  • @MonsterGames71
    @MonsterGames71 ปีที่แล้ว +14

    I would like to thank you for this amazing, detailed tutorial. This is exactly what I'm looking for. You're a lifesaver.

    • @programmingpercy
      @programmingpercy  ปีที่แล้ว +5

      Thank you for letting me know you enjoyed it!

  • @July-dh9lk
    @July-dh9lk 29 วันที่ผ่านมา +1

    Thank you! It's great. In two hours I've learned a lot. It's high quality course. I don't have much experience in coding, but I doubt I could have thought of some things on my own.

  • @YandryPozo
    @YandryPozo ปีที่แล้ว +11

    extremely well done and complete example, great job sir!

    • @programmingpercy
      @programmingpercy  ปีที่แล้ว +4

      Thank you sir, glad you enjoyed

    • @percybolmer4343
      @percybolmer4343 ปีที่แล้ว +1

      @@initialized glad you mentioned I my mic, I know it sucks!
      I am so happy to say that I have bought a Mic & Lightning !
      Just trying to fix a virtual green screen or physical one!
      Thanks for mentioning it, so that I can improve

  • @yegor3793
    @yegor3793 ปีที่แล้ว +2

    Hi I`m beginner in websockets and your video helped me to better undestand how to use gorilla building simple messengers.Your video is awesome!!

  • @dhaw
    @dhaw 9 หลายเดือนก่อน +3

    best golang ws chat tutorial, thanks a lot !!

    • @programmingpercy
      @programmingpercy  9 หลายเดือนก่อน

      Thank you for the kind words

  • @paca3107
    @paca3107 10 หลายเดือนก่อน +2

    thank you for this tutorial! I really appreciate that you invested your time to make this video.

  • @tokintmash
    @tokintmash หลายเดือนก่อน +1

    I think it's now like a sixth time I watch the "this is fairly fairly simple, I believe" part and finally I think I dare to move on. :D

  • @baptisteleroyer3758
    @baptisteleroyer3758 9 วันที่ผ่านมา +1

    thank you very much i learn a lot thank to your video

  • @jaypatel1393
    @jaypatel1393 ปีที่แล้ว +2

    This tutorial is awesome and explained so well - thanks

  • @evanfang6573
    @evanfang6573 ปีที่แล้ว +3

    Very clear. Very helpful.

    • @programmingpercy
      @programmingpercy  ปีที่แล้ว

      Thank you for the kind words, thrilled to hear you enjoyed

  • @jxiongdevdiary
    @jxiongdevdiary 11 หลายเดือนก่อน

    Thanks for the step-by-step guide!

  • @mahendranath2504
    @mahendranath2504 9 หลายเดือนก่อน +1

    Wow ,Thank you so much for sharing the amazing content, liked 👍 and subscribed

  • @PhilippeBazinet
    @PhilippeBazinet 7 หลายเดือนก่อน +1

    This is a great tutorial, thanks you!

  • @daicaphong84
    @daicaphong84 ปีที่แล้ว +2

    Amazing tutorial. Thank you

  • @bjugdbjk
    @bjugdbjk ปีที่แล้ว +2

    Simply Fantastic, helps me a lot.i came here reading your medium post, Thanks a ton brother for the amazing content.
    I have a question though...
    I am building an Android game using kotlin in the front end and i am planning to choose Go at the backend and obviously I wil be using websockets, this video helped !!

  • @SvartAdamSolander
    @SvartAdamSolander ปีที่แล้ว +1

    Great tutorial! Looking forward your other tutorials!
    Too bad that your mic isn’t great. I think your content is so good that I would gladly swish 30-50 kr towards a new microphone. :)

  • @pindi-zx4cs
    @pindi-zx4cs 8 หลายเดือนก่อน +1

    Awesome work bro

  • @mikealejandro3938
    @mikealejandro3938 10 หลายเดือนก่อน +3

    This is absolutely amazing, thanks nigga !!!

  • @tokintmash
    @tokintmash หลายเดือนก่อน

    Oh man, the way you're using Go routines and methods and structs... Struggling to keep up with everything :D

  • @skl9942
    @skl9942 7 หลายเดือนก่อน

    Awesome tutorial! I have one question, your pong/pong handling, from what I can tell its not doing anything if the client stops sending pongs back.

  • @Flascoo
    @Flascoo ปีที่แล้ว +1

    Great video!
    Micro from DDD video was definetly better btw

  • @nelsonbalmaceda7046
    @nelsonbalmaceda7046 ปีที่แล้ว +1

    Great video and topic

  • @fouad-hachour9968
    @fouad-hachour9968 ปีที่แล้ว +1

    many thanks

  • @notnull01
    @notnull01 ปีที่แล้ว +1

    Just what i was looking for, Thanks! is there a Part II? connecting to an external data storage (redis)?...

    • @programmingpercy
      @programmingpercy  ปีที่แล้ว +1

      Hey!
      Hmm no part 2 planned.
      I do have an article on using Redis for PubSub, maybe I can update it Abit and Record that video. Only exists as text atm.
      programmingpercy.tech/blog/redis-as-a-pub-sub-engine-in-go/

    • @notnull01
      @notnull01 ปีที่แล้ว

      @@programmingpercy thanks 🙏 reading it right now

  • @mr.mendez7094
    @mr.mendez7094 ปีที่แล้ว +2

    Thanks bro!, yau are the best!

    • @programmingpercy
      @programmingpercy  ปีที่แล้ว

      Nah, you're the best!

    • @mr.mendez7094
      @mr.mendez7094 ปีที่แล้ว

      ​@@programmingpercy BROOO two weeks developing for my company, and your tutorial was my handbook, you help us a lot with the structure of our system

    • @mr.mendez7094
      @mr.mendez7094 ปีที่แล้ว

      ​@@programmingpercy I'm a junior developer well, i'm still studing this engineering, but you help me a lot!!, i made a CRUD with your tutorial, you are the best

  • @dfdkjr8719
    @dfdkjr8719 ปีที่แล้ว +1

    When we say that Gorilla 'Connections only support one concurrent reader and one concurrent writer', does this mean that for *each* client connection we can only have one goroutine reading messages and one gorountine writing messages via a channel? Obviously, if we have multiple clients, there will be an equivalent number of reading and writing goroutines - but I assume this is not what the restriction is referring to?

    • @programmingpercy
      @programmingpercy  ปีที่แล้ว

      Great question!
      To clarify, the gorilla connection is not safe to have concurrent writers.
      This is only true for writing, data into the connection.
      They have an example in their source code with a lot of comments that explains this if you'd like a more in depth explanation.
      So in short, we simply cannot spawn multiple goroutines that all tries to write on the same time. It might work at first glance, but there is a race risk going on.
      That's why we instead send messages on a Channel, and then send those one at a time. To prevent concurrent writes.

  • @shubhamverma572
    @shubhamverma572 ปีที่แล้ว +1

    Firstly Thanks and Nice explained !!
    BTW I have one question, how do we handle the web socket connections in Distributed system (like multiple instance are running for the same service)

    • @programmingpercy
      @programmingpercy  ปีที่แล้ว

      Great question.
      At the point where you start running multiple instances, it is common to include Redis or RabbitMQ to allow distributed messages for the websockets.
      You would then listen on the PubSub schema used and push messages on RabbitMQ/Redis, then read from those topics and push onto the Websockets.

    • @shubhamverma572
      @shubhamverma572 ปีที่แล้ว

      @@programmingpercy thanks👍

  • @nasko235679
    @nasko235679 3 วันที่ผ่านมา +2

    This is proof that all great coding videos are made by guys with 10$ webcams and 1$ microphones because they're too busy actually working, and most greatly produced content is made by influencers who don't really know what they're talking about.

    • @programmingpercy
      @programmingpercy  3 วันที่ผ่านมา

      Wow those are some really nice words!
      Thanks!!!

  • @bjugdbjk
    @bjugdbjk ปีที่แล้ว +1

    Gorialla websocket is limiting to only 1 concurrent connection at a time, is this limitation only for Gorilla websocet or its same for other Go web libraries as well ?

    • @programmingpercy
      @programmingpercy  ปีที่แล้ว

      I know that the x/net/websocket supports multiple, but that package is also deprecated and frozen. That package has trouble with defragmented frames tho.
      I can't speak for gobws since I haven't used them.

    • @programmingpercy
      @programmingpercy  ปีที่แล้ว +2

      Let me make this clear, it's only limited to one concurrent WRITE, and this shouldn't pose an issue if implemented correctly, it scales pretty good. So I don't think many people have had an issue with that.

  • @9ezi435
    @9ezi435 ปีที่แล้ว

    Hi, I want to use go to connect to the asterisk server.

  • @boriskrasnov1672
    @boriskrasnov1672 10 หลายเดือนก่อน

    I want to ask in what moment data insert to c.egress in ReadMessages 1:10:00?

  • @TheRj725
    @TheRj725 ปีที่แล้ว

    Thanks for this, learnt a lot! I just have one question, how would you structure rooms? I dont want to broadcast mesaages to every client, I just want to send message to clients in a group. One thing I was thinking to do something like `/ws/{room_id}` and then clients will automatically be in a group thenI dont have to do any special in my code to handle rooms. Is this a correct assumption? EDIT- Okay, I just tested this,. it doesn't work this way xD

  • @hiyoutube6769
    @hiyoutube6769 ปีที่แล้ว

    sound is sick but good presentation

    • @programmingpercy
      @programmingpercy  ปีที่แล้ว +1

      I am making sure to fix the sound for future videos! Thanks!

  • @micha9138
    @micha9138 ปีที่แล้ว +1

    Gorilla? It is deprecated.

    • @programmingpercy
      @programmingpercy  ปีที่แล้ว +1

      Yeah! Video was made before that!
      I have in mind to create a new one but I haven't decided on which OS solution I like best amongst the others.

    • @michelemendel
      @michelemendel ปีที่แล้ว +1

      @@programmingpercy It's archived, but so what. It hasn't changed for many years, and it works. I wouldn't worry about using it.

    • @programmingpercy
      @programmingpercy  ปีที่แล้ว

      It's just if there is any RFCs that gets out that might be scary.

    • @notnull01
      @notnull01 ปีที่แล้ว +1

      @@programmingpercy cant wait, this video got me to understand websockets in go

    • @IvanRandomDude
      @IvanRandomDude ปีที่แล้ว +4

      It is active again

  • @catalinim4227
    @catalinim4227 11 หลายเดือนก่อน

    old stuff 🎉

  • @m_205
    @m_205 ปีที่แล้ว

    Gorilla is dead.

    • @programmingpercy
      @programmingpercy  ปีที่แล้ว +1

      Actually that's not true
      www.reddit.com/r/golang/comments/1528e25/gorilla_web_toolkit_new_maintainers_announcement/?
      It's alive again

    • @m_205
      @m_205 ปีที่แล้ว +1

      Thanks brother, have a good day

  • @sahildhingraa
    @sahildhingraa ปีที่แล้ว

    didn't understand anything even after spending 3 days to watching this tutorial

    • @codeunited5905
      @codeunited5905 ปีที่แล้ว

      No way, man! It's not even that hard. You mustn't have coded along with the video. This video is a gem. I spend like a day watching this tutorial for my chat application and I guess I've implemented the websocket part of the application effectively. I implemented something similar after watching the video, an event based websocket system, but with slight differences. Instead of using OTP, I'm using JWT for authorization, MongoDB for storing user details and messages (I'm not using any message queues or stuff for now as it might add unwanted complexity to the program), and gin frame work to stick everything together. If you are not a video person, just read his blog. It's much easier to follow along. Also, try to understand the logic behind websockets and how to utilise it. Then implement it in your own way, which you will find is much easier to maintain the code base. Happy coding!

    • @sahildhingraa
      @sahildhingraa ปีที่แล้ว +1

      @@codeunited5905 no I was coding alongside the video but didn't understand anything. It's my personal opinion, no hate to you or your channel.

    • @programmingpercy
      @programmingpercy  ปีที่แล้ว +5

      No worries man, no offense taken.
      It's really hard to create content that fits everybodies needs.
      One might find a tutorial progressing too fast whilst others find it way to slow.
      But if you don't mind me asking, what in particular made it hard for you to follow?
      Is it to fast? Would you like deeper explaining on what's going on?
      It would be great to know so I can improve future videos

    • @sahildhingraa
      @sahildhingraa ปีที่แล้ว

      @@programmingpercy I'm a beginner in golang, so most of the concepts were confusing for me

    • @varunzid123
      @varunzid123 7 หลายเดือนก่อน +2

      Bruh
      The video shows at the beginning that he expects viewers to be ‘somewhat familiar with go’
      You need to build your basics before you could reach the skill level for this video
      No hate is good, you better come back and rewatch after you progress

  • @SwarajSingh-xs6dy
    @SwarajSingh-xs6dy ปีที่แล้ว

    Man what do I use gorilla mux or socket io for golang ?

    • @programmingpercy
      @programmingpercy  ปีที่แล้ว

      I like gorilla much, there was a bit trouble when the maintainer decided to archive it.
      But since then it has gotten a group of new maintainers and is in a good place.
      I'd stick with Gorilla,