Updated example with IPC connection
This commit is contained in:
parent
11f5e7b390
commit
5e0625e197
|
@ -2,9 +2,12 @@ var StatusJS = require('./dist/index.js');
|
||||||
|
|
||||||
(async () => {
|
(async () => {
|
||||||
var status = new StatusJS();
|
var status = new StatusJS();
|
||||||
await status.connect("ws://localhost:8546", "0x0011223344556677889900112233445566778899001122334455667788990011");
|
//await status.connect("ws://localhost:8546", "0x0011223344556677889900112233445566778899001122334455667788990011");
|
||||||
// await status.connect("/home/richard/.statusd/geth.ipc");
|
|
||||||
console.log(await status.getPublicKey());
|
await status.connect("/home/richard/.statusd/geth.ipc", "0x0011223344556677889900112233445566778899001122334455667788990011");
|
||||||
|
|
||||||
|
|
||||||
|
console.log(await status.getPublicKey());
|
||||||
const channel = "mytest";
|
const channel = "mytest";
|
||||||
await status.joinChat(channel);
|
await status.joinChat(channel);
|
||||||
|
|
||||||
|
@ -24,15 +27,14 @@ console.log(await status.getPublicKey());
|
||||||
status.mailservers.useMailserver(enode, (err, res) => {
|
status.mailservers.useMailserver(enode, (err, res) => {
|
||||||
|
|
||||||
// Group chats
|
// Group chats
|
||||||
let from = 1544783388; // unix timestamp
|
let from = parseInt((new Date()).getTime() / 1000 - 86400, 10);
|
||||||
let to = 1544846928;
|
let to = parseInt((new Date()).getTime() / 1000, 10);
|
||||||
|
|
||||||
status.mailservers.requestChannelMessages(channel, {from, to}, (err, res) => {
|
status.mailservers.requestChannelMessages(channel, {from, to}, (err, res) => {
|
||||||
if(err) console.log(err);
|
if(err) console.log(err);
|
||||||
});
|
});
|
||||||
|
|
||||||
// User messages
|
// User messages
|
||||||
from = parseInt((new Date()).getTime() / 1000 - 6000, 10);
|
|
||||||
to = parseInt((new Date()).getTime() / 1000, 10);
|
|
||||||
status.mailservers.requestUserMessages({from, to}, (err, res) => {
|
status.mailservers.requestUserMessages({from, to}, (err, res) => {
|
||||||
if(err) console.log(err);
|
if(err) console.log(err);
|
||||||
});
|
});
|
||||||
|
|
Loading…
Reference in New Issue