I would recommended to use this documentation : https://github.com/ethereum/go-ethereum/wiki/Whisper
Whisper usage
your posted links are outdated and moreover are for Whisper v 2.0
Answer: It's possible 1:N message if you provide identical symKey for all recipients.
P.S. My posted links are for Whisper 5.0 , current version of Whisper is 6.0 but but the API for v6 is almost identical to v5 anyway.
On node-1's geth-client:
generatedSymKey=shh.generateSymKeyFromPassword("hello");
symKey=shh.getSymKey(generatedSymKey)
symKeyID=shh.addSymKey(symKey) //ex: "d5212e736703afbb21246e8acd192e4345ea910398544d765ed6b49f0ec524b5"
filter = web3.shh.newMessageFilter(
{symKeyID:symKeyID, topic: '0x07678231'},
function(err, res) {console.log(web3.toUtf8(res.payload))});
On node-2's geth-client:
generatedSymKey=shh.generateSymKeyFromPassword("hello")
symKey=shh.getSymKey(generatedSymKey)
symKeyID=shh.addSymKey(symKey) //ex: "c4c4cecf6ad9499c2386b8ce6416f44684e042e491726b38315646c0b4afadc6"
filter = web3.shh.newMessageFilter(
{symKeyID:symKeyID, topic: '0x07678231'},
function(err, res) {console.log(web3.toUtf8(res.payload))});
Than, sending message on another node and both messages show up on node-1 and node-2 even if symKeyID
is either node-1's or node-2's on shh.post()
function.
Following code is run on node-1's geth-client
:
node-1's symKeyID
is given:
web3.shh.post({
symKeyID: 'd5212e736703afbb21246e8acd192e4345ea910398544d765ed6b49f0ec524b5', //symKeyID of the node-1
ttl: 10,
topic: '0x07678231',
powTarget: 2.01,
powTime: 2,
payload: web3.fromAscii("Hello there!")
});
OR
Following code is run on node-2's geth-client
:
node-2's symKeyID
is given:
web3.shh.post({
symKeyID: 'c4c4cecf6ad9499c2386b8ce6416f44684e042e491726b38315646c0b4afadc6', //symKeyID of the node-2
ttl: 10,
topic: '0x07678231',
powTarget: 2.01,
powTime: 2,
payload: web3.fromAscii("Hello there!")
});