Don't Use Websockets (Until You Try This…)

preview_player
Показать описание
Using websockets increases the code and infrastructure complexity of your app, especially as you scale horizontally. Depending on your needs, you may be able to use Server Sent Events (SSE) instead. Server Sent Events is more efficient than polling, but simple to implement on both the backend and frontend.
Рекомендации по теме
Комментарии
Автор

Note: Depending on your specific project, using SSE you may still result into the same horizontal scaling challenges as WS (e.g. sticky sessions/central sessions store). It entirely depends on what kind of feature you’re implementing and how you're moving data around. But I’ve found that SSE provides a simpler base to implement realtime functionality if the client is mostly just receiving updates.

^^^ That thread also includes some interesting discussions around SSE.

codewithryan
Автор

I swear to god EVERYthing you talk about is soo god damn relevant to what Im working on at any given time. I am so glad I discovered this channel

dabbopabblo
Автор

SignalR covers all the scenarios you mentioned. By default it will try to use web sockets and gracefully fall back to the other transport types. However you can configure it to use a specific transport type. Just remember, with WS and SSE, you may have to explicitly configure routers

hszbtyf
Автор

just found your channel (by searching for the differences between Rust and Go) and I must say that your channel is totally underrated. There are many channels with 500k+ subs out there that don't even match the quality this channel has. I also like the simplicity of the channel. I go walking quite often and I can listen to your videos on my headphones because I can understand most of the things just from listening to your voice. Keep up the good work and please make more videos like this where you go through some "slides" and explain/compare things.

funnycompilations
Автор

Today I learned! I didn’t know there was an intermediate solution to server-side push between polling and websockets. Great presentation of the options too. Thanks!

CameronFlint
Автор

Hello, thanks for mentioning this technology. This is a good way to get simple one-way events like "server to client", but in most cases, when an application moves to an event-based messaging model, SocketIO or WebRTC is used. SocketIO has a wonderful fallback mechanism for older browsers that uses pooling. At the same time, WebRTC allows you to set up a fast exchange model + additional sugar for working with video, audio and text streams.

lavenir
Автор

I just watched this on 1.5x and the Quality and Structure of the Information was superb, keep it that way

bastian
Автор

I'm getting into Go and microservices, so I really enjoy your content. Very well explained and enjoyable to watch.

jochemmm
Автор

wow ive never heard of SSE before, i was just about to start making a project that eas going to need server -> client communication and didn't want to deal with th3 complexity of websockets; this is perfect! great video as well

whamer
Автор

damn Ryan, you are just plain awesome! I came to your channel by just searching YT for videos on websockets and because your were so high in the search result list I thought you have some big production with videos on every possible topic. But no! I see you just recently started the channel and all the videos you made sound super interesting! No bs, only interesting topics, only interesting tech. I promis you I'm gonna watch them all. good luck with the channel!

paulgaiduk
Автор

A very good video, good theory with diagrams and a technical example. All of this in under 10 minutes ! Very impressed and I learned a lot, thanks

Gandalf_Le_Dev
Автор

Outstanding job. TIL about SSE and this video definitely explained the process very well. PROUD of YOU

mrmagnetic
Автор

Hey man I really liked the vid. It's clear that you've put some thought into what makes a clear, concise instructional video and I plan on checking out your other videos now!

seanweber
Автор

Man, what a great voice! Just found your channel and I'm listening just because it sounds incredible. Keep up with the good job.

cirosobral
Автор

You are awesome! I've heard about SSE but never knew how actually do that. Thank you, bro!

cellocarlos
Автор

Kudos for talking about this little-known/little-used feature for us web developers!

danielgilleland
Автор

It's pretty simple and for me it's indeed the best solution for notification system and can also be used for realtime chats.

Excellent video!

OtakujiOfficial
Автор

I had NO idea this exists, this is such a cool mechanism, thank you very much for sharing!

Mane
Автор

Interesting I do think that websockets are going to be a lot cleaner in the code and require less data to be sent between, you are going to run into similar issues with both Server-Side events and Websockets when scaling, at least with websockets its better documented and understood. But I do like how you pointed out some differences and I think its good to understand and know as many options as possible.

What I would be interested in is a way to communicate between a server and client using no javascript, something like long-polling. This would be great for people who use TOR and aren't using javascript because of privacy and security concerns. I have seen some interesting solutions to this but so far nothing very clean.

Would be huge for privacy and security people if someone found a solution to this. I imagine an instant chat application that ran securely through TOR with no javascript would be pretty huge.

Thegamecheats
Автор

Hi! I just found your channel via the GTA 3 code review. Great stuff sir thank you for sharing your knowledge.

LegitoTV
welcome to shbcf.ru