Skip to content
This repository has been archived by the owner on Nov 29, 2023. It is now read-only.

Commit

Permalink
fixed shh
Browse files Browse the repository at this point in the history
  • Loading branch information
simon-jentzsch committed Nov 21, 2015
1 parent 1edfbec commit ece4132
Show file tree
Hide file tree
Showing 3 changed files with 38 additions and 3 deletions.
31 changes: 31 additions & 0 deletions .vscode/launch.json
@@ -0,0 +1,31 @@
{
"version": "0.2.0",
"configurations": [
{
"name": "Launch",
"type": "node",
"request": "launch",
"program": "bin/slock.js",
"stopOnEntry": false,
"args": [],
"cwd": "./bin",
"runtimeExecutable": null,
"runtimeArgs": [
"--nolazy"
],
"env": {
"NODE_ENV": "development"
},
"externalConsole": false,
"preLaunchTask": "",
"sourceMaps": false,
"outDir": null
},
{
"name": "Attach",
"type": "node",
"request": "attach",
"port": 5858
}
]
}
3 changes: 3 additions & 0 deletions modules/debug.js
Expand Up @@ -7,5 +7,8 @@ module.exports = function() {
this.events.on('changeState',function(arg) {
console.log('Debug : open '+arg.id+"="+arg.open);
});
this.events.on('message',function(m) {
console.log('Debug : message '+JSON.stringify(m));
});
};
};
7 changes: 4 additions & 3 deletions modules/shh.js
Expand Up @@ -18,9 +18,10 @@ module.exports = function () {
var web3 = contract.web3;

// watch for incoming messages
web3.shh.watch({
'topic': [ normalizeAdr(contract.config.adr) ]
}).arrived(function(m) {
web3.shh.filter({
// remove the web3.fromAscii if it is fixed!
'topics': [ web3.fromAscii(normalizeAdr(contract.config.adr)) ]
}).watch(function(error,m) {
events.emit("message", { to: normalizeAdr(contract.config.adr), msg: web3.toAscii(m.payload[0]), from:m.payload[1] });
});

Expand Down

0 comments on commit ece4132

Please sign in to comment.