From e171fecf4bd2231aaebbb3f1c71bc9a11dc71c08 Mon Sep 17 00:00:00 2001 From: GarryOne Date: Sat, 25 Jul 2015 03:22:50 +0300 Subject: [PATCH] Added support for online/offline status of users I added these 2 events too. --- README.md | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/README.md b/README.md index 7f9b12c..8743bf5 100644 --- a/README.md +++ b/README.md @@ -85,6 +85,14 @@ Event::listen('app.success',function($client_data){ Event::listen('app.error',function($client_data){ return BrainSocket::error(array('There was a Laravel App Error!')); }); + +Event::listen('someone_connected',function($client_data) { + return BrainSocket::message('someone_connected',array('Some user signed in right now!')); +}); + +Event::listen('someone_disconnected',function($client_data) { + return BrainSocket::message('someone_disconnected',array('Some user signed out right now!')); +}); ``` **Note:** The `$client_data` parameter passed into the event listener is a POPO (Plain Old PHP Object) with all of the data passed from the client side. @@ -103,4 +111,4 @@ Great! Now we have a few events to test out on the client side. Run the artisan To make things easier we have created a simple js helper that allows us to interact with our new ws server a bit easier. It's not required but it handles some minor formatting tasks in the background so you don't have to and pairs nicely with our BrainSocket Facade. -Head over to [https://github.com/BrainBoxLabs/brain-socket-js](https://github.com/BrainBoxLabs/brain-socket-js) to grab it. \ No newline at end of file +Head over to [https://github.com/BrainBoxLabs/brain-socket-js](https://github.com/BrainBoxLabs/brain-socket-js) to grab it.