Before we touch Laravel, let's get our feet wet in this Socket.io world. We'll build a basic chat application, while learning how to emit and listen for events.
View the source for this lesson on GitHub.
Redis is an excellent in-memory data store. Did you know that Laravel offers support for it right out of the box? Let's figure out how to activate it so that we may publish events, and catch them from our Node server.
We're making great progress. Now that we have Redis working on the Laravel end, let's setup a Redis client on the Node side of things, so that we can "catch" events. This will give us the proper hook to then leverage Socket.io to alert the client of the update.
View the source for this episode on GitHub.
So far, we've simply used Laravel's Redis facade to publish message (which we then catch from our Node Redis client). This time, let's create a typical event class. As you'll find, as of Laravel 5.1, we only have to implement an interface to trigger broadcasting to the client!