Updated Whisper Push Notifications (markdown)

Victor Farazdagi 2017-04-11 23:42:34 +03:00
parent 46e5912edd
commit 6fa6fc82fc
1 changed files with 4 additions and 3 deletions

@ -182,8 +182,9 @@ var newChatSessionTopic = '0x509579a2'; // NEW_CHAT_SESSION
var ackNewChatSessionTopic = '0xd012aae8'; // ACK_NEW_CHAT_SESSION
var createChatSession = function (subscriptionKey) {
var chatId = '0xdeadbeef';
// subscriptionKey is key shared by server that allows us to communicate with server privately
var keyname = 'SUBSCRIPTION_KEY';
var keyname = 'SUBSCRIPTION_KEY'; // you might want to be tad more creative
web3.shh.deleteSymKey(keyname);
web3.shh.addSymKey(keyname, subscriptionKey);
@ -208,8 +209,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
registerDevice(payload.key);
shareChatKey(payload.key);
registerDevice(chatId, payload.key);
shareChatKey(chatId, payload.key);
}
});