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

Commit a43252b

Browse files
Adding ability to (un/)subscribe to topics at firebase #262 - doc
1 parent 0f09d14 commit a43252b

File tree

1 file changed

+15
-0
lines changed

1 file changed

+15
-0
lines changed

docs/MESSAGING.md

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -102,6 +102,21 @@ Similarly to the message callback you can either wire this through `init` or as
102102
);
103103
```
104104

105+
### Send messages to Topics
106+
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.
107+
108+
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.
109+
110+
```js
111+
firebase.subscribeToTopic("news");
112+
```
113+
114+
and:
115+
116+
```js
117+
firebase.unsubscribeFromTopic("news");
118+
```
119+
105120
## Testing
106121
Using the Firebase Console gives you most flexibility, but you can quickly and easily test from the command line as well:
107122

0 commit comments

Comments
 (0)