Updated Whisper Push Notifications (markdown)
parent
60ba35fa57
commit
1fa7f0e2eb
|
@ -208,7 +208,8 @@ var createChatSession = function (subscriptionKey) {
|
|||
// 1. register our device with that chat
|
||||
// 2. share that key with others, so that they can register themselves
|
||||
// 3. use chat key to trigger notifications
|
||||
shareAndUseChatKey(payload.key)
|
||||
registerDevice(payload.key);
|
||||
shareAndUseChatKey(payload.key);
|
||||
}
|
||||
});
|
||||
|
||||
|
@ -228,20 +229,28 @@ var createChatSession = function (subscriptionKey) {
|
|||
```
|
||||
Now, we have Chat Session Key, which we can use to register our device id (to be used as target by FCM), and allow others to register themselves.
|
||||
|
||||
Let's see how `registerDevice()` might look like:
|
||||
```js
|
||||
```
|
||||
|
||||
### 3. Sharing Chat session key, and allowing notifications
|
||||
|
||||
So, all we need to review is device registration and key sharing. Let's continue with `Device A` web3 object:
|
||||
So, on `Device A` side, we have Chat Session Key, and we registered the device with that session. Now, we need to send/share the SymKey:
|
||||
|
||||
```js
|
||||
```
|
||||
|
||||
Now, on `Device B` side, we need to wait for shared key, and then once we register `Device B`, we will be able to send notifications:
|
||||
On `Device B` side, we need to wait for shared key, and then, once we get it, register `Device B` with the chat session.
|
||||
|
||||
```js
|
||||
```
|
||||
|
||||
### 4. Triggering Push Notifications
|
||||
Time to trigger notifications:
|
||||
```js
|
||||
```
|
||||
|
||||
# Implementation notes I: One-to-One Chats
|
||||
|
||||
# Implementation notes II: Group Chats
|
||||
# Implementation notes II: Group Chats
|
||||
|
||||
# Complete Sample
|
Loading…
Reference in New Issue