Skip to content
This repository has been archived by the owner on Apr 4, 2023. It is now read-only.

Commit

Permalink
Adding ability to (un/)subscribe to topics at firebase #262 - doc
Browse files Browse the repository at this point in the history
  • Loading branch information
EddyVerbruggen committed Jan 17, 2017
1 parent 0f09d14 commit a43252b
Showing 1 changed file with 15 additions and 0 deletions.
15 changes: 15 additions & 0 deletions docs/MESSAGING.md
Original file line number Diff line number Diff line change
Expand Up @@ -102,6 +102,21 @@ Similarly to the message callback you can either wire this through `init` or as
);
```

### Send messages to Topics
Based on the publish/subscribe model, FCM topic messaging allows you to send a message to multiple devices that have opted in to a particular topic. You compose topic messages as needed, and FCM handles routing and delivering the message reliably to the right devices.

Client apps can subscribe to any existing topic, or they can create a new topic. When a client app subscribes to a new topic name (one that does not already exist for your Firebase project), a new topic of that name is created in FCM and any client can subsequently subscribe to it.

```js
firebase.subscribeToTopic("news");
```

and:

```js
firebase.unsubscribeFromTopic("news");
```

## Testing
Using the Firebase Console gives you most flexibility, but you can quickly and easily test from the command line as well:

Expand Down

0 comments on commit a43252b

Please sign in to comment.