Skip to content

Commit

Permalink
README update for subscription. Skadoosh...!
Browse files Browse the repository at this point in the history
  • Loading branch information
tiholic committed Jul 24, 2020
1 parent a6de32a commit 824c8db
Showing 1 changed file with 17 additions and 0 deletions.
17 changes: 17 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -134,6 +134,23 @@ Detaching from channel
await channel.detach();
```

Subscribing to channel messages

```dart
Stream<ably.Message> messageStream = channel.subscribe();
StreamSubscription<ably.Message> channelMessageSubscription = messageStream.listen((ably.Message message){
print("New message arrived ${message.data}");
});
```

_use `channel.subscribe(name: "shifu")` or `channel.subscribe(names: ["shifu", "oogway"])` to listen to specific named messages_

UnSubscribing from channel messages

```dart
await channelMessageSubscription.cancel();
```

## Caveats

#### RTE6a compliance
Expand Down

0 comments on commit 824c8db

Please sign in to comment.