2018-12-01 04:12:19 +00:00
|
|
|
var StatusJS = require('./dist/index.js');
|
2018-11-06 14:01:41 +00:00
|
|
|
|
|
|
|
(async () => {
|
|
|
|
var status = new StatusJS();
|
2018-11-07 22:27:34 +00:00
|
|
|
await status.connect("ws://localhost:8546");
|
2018-11-06 14:01:41 +00:00
|
|
|
|
|
|
|
await status.joinChat("mytest");
|
|
|
|
await status.joinChat("mytest2");
|
|
|
|
|
|
|
|
status.onMessage("mytest", (err, data) => {
|
|
|
|
console.dir("received from api");
|
|
|
|
console.dir("message received!");
|
|
|
|
console.dir(data);
|
|
|
|
});
|
|
|
|
|
|
|
|
status.onMessage("mytest2", (err, data) => {
|
|
|
|
console.dir("received from mytest2");
|
|
|
|
console.dir("message received!");
|
|
|
|
console.dir(data);
|
|
|
|
});
|
|
|
|
|
|
|
|
status.sendMessage("mytest", "hello world!");
|
|
|
|
|
|
|
|
setInterval(() => {
|
|
|
|
status.sendMessage("mytest", "hello world!");
|
|
|
|
status.sendMessage("mytest2", "hello world!2");
|
|
|
|
}, 3000);
|
|
|
|
|
|
|
|
})()
|