Go WebSocket Tutorial with the gorilla/websocket Package

preview_player
Показать описание

● SUBSCRIBE to see more of my Videos & hit that LIKE button to support the channel!

Hi Fellow Devs! In this tutorial, we are going to be looking at how we can use WebSockets within our own Go-based programs to do some cool real-time stuff.

By the end of this tutorial, we should have covered the following:

* What WebSockets are
* How we can build simple WebSocket Applications in Go

For the purpose of this tutorial, we’ll be working with the gorilla/websocket package as I’ve used it personally in a few production applications to great success.

Рекомендации по теме
Комментарии
Автор

A slight update to the code - Move the CheckOrigin check to the upgrader struct so that there isn't a data race:

var upgrader = websocket.Upgrader{
ReadBufferSize: 1024,
WriteBufferSize: 1024,
CheckOrigin: func(r *http.Request) bool { return true },
}

Tutorialedge
Автор

This is super useful! Thank you for the great and precise content!

auctifer
Автор

youre a genius, solved me a problem that took me 7 days in 13 minutes

lioraviv
Автор

Simply amazing, this is Golang web sockets made simple

eduardofernandezdiaz
Автор

Awesome video! Many links online about Hello World with websockets just didn't work. I didn't get it working until this awesome video which does exactly what it says. Cheers!

RickLeVan
Автор

I liked your content, keep it up mate 👏

serhat
Автор

Hello, thank you so much for this tutorial, can you please extend it to validate clients, authorization and some kind of identification for passing json between? Could be so nice.

mekinon
Автор

Didnt watched it right now, but currently am into this topic. Next video, please incorporate gRPC protocol buffers. Like.. receive nested JSON from WebSocket and Unmarshall into ProtoBuf and back - feed protobuf into websocket as JSON. :)

Oswee
Автор

great video, I like it !. Please make more video about ws in more details, if you could please make another video about gobwas lib. Thank you

fouad-hachour
Автор

Hi, how did you configure your terminal? It is amazing! Is there something I could follow?

fehoehc
Автор

do we need to use mutex fort web socket as well ?

larrystreehouse
Автор

Can someone help me, how I can store and load websocket object from redis? Thank you.

VukotaDjLewu
Автор

Please do more videos for Go with mongodb.

jeyraj
Автор

am intrigue on your vscode config eg theme can you help me out?

anthonyanonde
Автор

thank you conor mcgregor! i didn't know you make programming tutorials

elderofzion
Автор

Great video! What is the name of the theme do you use in vs code?

eniqen
Автор

Video is great, but how no one see that he did not send message but he received message, or did i miss something to catch up ?

vikrammali
Автор

Hey, I tried to implement websockets into my existing go web app but when the client browser attempts to connect the server issues this error message: Endpoint Error: websocket: response does not implement http.Hijacker. A bit more about the web app ... I'm using scs (Session Manager) with all routes. However if I take out the scs, the client connects without error. So my issue seems to be with the scs SessionManager. Any ideas as to how I implement HiJack? I cannot find any solid demonstration.

xuoxodxuoux
Автор

I'm getting a 1006 websocket connect error on the JS end :S

EDIT: I forgot to put /ws at the end of the connection URL in JS.

amcsi
Автор

I don't understand about live-server, and how both brosers at 11:53 related!! bit confusing!

chandrareddy