Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 9 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -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.
Expand All @@ -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.
Head over to [https://github.com/BrainBoxLabs/brain-socket-js](https://github.com/BrainBoxLabs/brain-socket-js) to grab it.