Websockets in Laravel: Part 0 - What are Websockets?

Опубликовано: 13 Февраль 2018
на канале: DevMarketer
37,577
913

Before we can master websockets, its important that we first understand them and the terminology that surrounds them. You will encounter lots of funny words while you study websockets and read documentation about them. So the goal of this video is to make sure that we cover what these terms mean and also all of the parts that are at play when we work with websockets.

There are three main components with websockets: your web server, the socket server, and the client-side browser.

The web server is what runs your normal server-side framework. This program generally has an event system, that when triggered will send an API or webhook (POST) request over to your socket server. This lets the socket server know that an event occurred and the information that pertains to it. The web server will pass important information over to the socket server as part of the request like the information about the event. For example if we want to notify the socket server of a "New Transaction" event, we might also pass in the transaction details like the transaction amount or transaction id.

The socket server's job is to manage connections and to distribute events. Clients will connect to the socket server via channels. These channels are segregated groups that allow us to keep events localized only on channels that apply to the event. The socket server keeps track of who is subscribed to certain channels and who unsubscribes, and which clients might lose connection. This way, when the socket server receives a new event from the web server it knows who it should send the event information to, based on who is connected to the various channels. The socket server will then distribute the event to any clients subscribed at the time, to an appropriate channel for that event.

The socket server itself doesn't update the information on a client's browser window. We will use Laravel Echo or another client side library (such as the pusher-js library) to listen for events on the channel and do something when an event occurs. At this point we can write any standard javascript function or use a javascript function to handle the triggering of an event. We can also grab this payload and use that information to display something on screen to the user.

All of this happens in real time and this power enables us to create wonderful experiences for our users.

==== DOWNLOAD SLIDES ====



==== WRITTEN TUTORIALS ====

"Mastering Websockets in Laravel" Master Series Page:
https://devmarketer.io/learn/laravel-...

Part 0: What are Websockets?


==== MORE FROM THIS SERIES . ====

Full Playlist for the "Mastering Websockets in Laravel" Series:
   • Mastering Websockets in Laravel  


==== DOWNLOAD SOURCE CODE ====
Github Code Repo for this Series:
https://github.com/DevMarketer/Larave...


==== FOLLOW ME ====

Subscribe for New Releases!

Subscribe to DevMarketer Insider (Email)
https://confirmsubscription.com/h/d/5...

Twitter -   / _jacurtis  
(ask me questions!)


==== QUESTIONS? ====

Leave a comment below and I or someone else can help you.
For quick questions you may also want to ask me on Twitter, I respond almost immediately.

Email me [email protected]

Thanks for all your support!


Смотрите видео Websockets in Laravel: Part 0 - What are Websockets? онлайн без регистрации, длительностью часов минут секунд в хорошем качестве. Это видео добавил пользователь DevMarketer 13 Февраль 2018, не забудьте поделиться им ссылкой с друзьями и знакомыми, на нашем сайте его посмотрели 37,57 раз и оно понравилось 91 людям.