Updated Whisper Push Notifications (markdown)

Victor Farazdagi 2017-04-11 23:42:34 +03:00
parent 46e5912edd
commit 6fa6fc82fc

@ -182,8 +182,9 @@ var newChatSessionTopic = '0x509579a2'; // NEW_CHAT_SESSION
var ackNewChatSessionTopic = '0xd012aae8'; // ACK_NEW_CHAT_SESSION var ackNewChatSessionTopic = '0xd012aae8'; // ACK_NEW_CHAT_SESSION
var createChatSession = function (subscriptionKey) { var createChatSession = function (subscriptionKey) {
var chatId = '0xdeadbeef'; var chatId = '0xdeadbeef';
// subscriptionKey is key shared by server that allows us to communicate with server privately // 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.deleteSymKey(keyname);
web3.shh.addSymKey(keyname, subscriptionKey); web3.shh.addSymKey(keyname, subscriptionKey);
@ -208,8 +209,8 @@ var createChatSession = function (subscriptionKey) {
// 1. register our device with that chat // 1. register our device with that chat
// 2. share that key with others, so that they can register themselves // 2. share that key with others, so that they can register themselves
// 3. use chat key to trigger notifications // 3. use chat key to trigger notifications
registerDevice(payload.key); registerDevice(chatId, payload.key);
shareChatKey(payload.key); shareChatKey(chatId, payload.key);
} }
}); });