diff --git a/Whisper-Push-Notifications.md b/Whisper-Push-Notifications.md index 11f7026..7c116bf 100644 --- a/Whisper-Push-Notifications.md +++ b/Whisper-Push-Notifications.md @@ -52,7 +52,7 @@ var sendDiscoveryRequest = function (identity) { ``` Here is the list of topics (see the full sample file, where they are all used): -``` +```js var discoverServerTopic = '0x268302f3'; // DISCOVER_NOTIFICATION_SERVER var proposeServerTopic = '0x08e3d8c0'; // PROPOSE_NOTIFICATION_SERVER var acceptServerTopic = '0x04f7dea6'; // ACCEPT_NOTIFICATION_SERVER @@ -78,24 +78,21 @@ statusd --datadir app2 --http --httpport 8745 --shh # Workflow: Discovery, Subscription, Chat Management, Notification Triggering -Original workflow for discovery mechanism was introduced in: - -[![image](https://cloud.githubusercontent.com/assets/188194/24608168/19317cdc-187e-11e7-995e-2adadc17a91c.png)](https://cloud.githubusercontent.com/assets/188194/24608168/19317cdc-187e-11e7-995e-2adadc17a91c.png) - ### 1. Discovery request and Notification Server selection -Everything starts with `Device A` willing to register with some Notification Service Provider. To do so, it sends/broadcasts discovery request: +Everything starts with `Device A` willing to register with some Notification Service Provider. To do so, it sends discovery request *to some known cluster* (as you need to specify PubKey used on wnode side): ```js +var protocolKey = '0x040edb0d71a3dbe928e154fcb696ffbda359b153a90efc2b46f0043ce9f5dbe55b77b9328fd841a1db5273758624afadd5b39638d4c35b36b3a96e1a586c1b4c2a'; var discoverServerTopic = '0x268302f3'; // DISCOVER_NOTIFICATION_SERVER var sendDiscoveryRequest = function (identity) { - // notification server discovery request is a signed (sent from us) broadcast, - // encrypted with Notification Protocol Symmetric Key (which is publicly known) + // notification server discovery request is a signed (sent from us), + // encrypted with Notification Protocol Asymmetric (Public) Key var err = web3.shh.post({ from: identity, + to: protocolKey, topics: [discoverServerTopic], - ttl: 20, - keyname: 'NOTIFICATION_PROTOCOL_KEY' + ttl: 20 }); if (err !== null) { console.log("message NOT sent") @@ -103,7 +100,6 @@ var sendDiscoveryRequest = function (identity) { console.log("message sent OK") } }; - var identity = web3.shh.newIdentity(); sendDiscoveryRequest(identity); ```