Skip to content

Commit

Permalink
Update README.md
Browse files Browse the repository at this point in the history
  • Loading branch information
kakajansh committed Feb 9, 2019
1 parent 87c36b9 commit 8d561ce
Showing 1 changed file with 32 additions and 7 deletions.
39 changes: 32 additions & 7 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,16 +1,41 @@
# echo
## Laravel Echo for Flutter

Laravel Echo for your Flutter apps.
Basically, this package is port of official [Laravel Echo javascript library](https://github.com/laravel/echo). It helps subscribe to channels and listen for events broadcast from your Laravel app.

Three connectors available:
- [ ] Pusher
- [x] Socket.io
- [x] Null

## Getting started

For now, only `socket.io` connector implemented. You need to install [socket_io_client](https://pub.dartlang.org/packages/socket_io_client) for your Flutter app.

In your `pubspec.yaml` file:

```yaml
dependencies:
...
socket_io_client: ^0.9.1
laravel_echo:
```
#### Usage:
```dart
IO.Socket socket = IO.io('http://localhost:6001', <String, dynamic>{'transports': ['websocket']});

Echo echo = new Echo({
'broadcaster': 'socket.io',
'client': socket,
'broadcaster': 'socket.io',
'client': socket,
});

echo.channel('channel-name').listen('EventName', (e) {
print(e);
echo.channel('test').listen('TestEvent', (e) {
print(e);
});
```

socket.on('connect', (_) => print('connect'));
socket.on('disconnect', (_) => print('disconnect'));
```

Package by [Kakajan SH](http://kakajan.sh)

0 comments on commit 8d561ce

Please sign in to comment.