Update README with content and format - pt 4

This commit is contained in:
Richard Ramos 2019-02-10 21:42:51 -04:00
parent 07e19f0dde
commit 7cd4f5c8ec
3 changed files with 59 additions and 13 deletions

View File

@ -253,6 +253,62 @@ Arguments
### sendGroupMessage
Send a message to a public channel
```javascript
status.sendGroupMessage(channel, message, [cb]);
```
```javascript
status.sendGroupMessage("#mytest", "Hello world!", (err, data) => {
if (err) {
console.error(err);
return;
}
// Do something
});
```
Arguments
* _channel_ - public channel name.
* _msg_ - message to send
* _cb_ - a callback that will be called, possibly with an error, when a message is sent. If there is no error, the first argument will be null.
### sendUserMessage
Send a message to a contact code
```javascript
status.sendUserMessage(pubKey, message, [cb]);
```
```javascript
status.sendUserMessage("0x1122...9900", "Hello world!", (err, data) => {
if (err) {
console.error(err);
return;
}
// Do something
});
```
Arguments
* _pubKey_ - user public key
* _msg_ - message to send
* _cb_ - a callback that will be called, possibly with an error, when a message is sent. If there is no error, the first argument will be null.
## TODO: Create documentation for sending messages
* sendJsonMessage(destination, msg, [cb])
* sendMessage(destination, msg, [cb])
### getPublicKey
Returns a string with the public key
@ -316,14 +372,6 @@ Arguments
## TODO: Create documentation for sending messages
* sendUserMessage(contactCode, msg, [cb])
* sendGroupMessage(channelName, msg, [cb])
* sendJsonMessage(destination, msg, [cb])
* sendMessage(destination, msg, [cb])
### mailservers.useMailserver
Use a specific mailserver to obtain old messages. Active mailservers from Status.im can be found [here](https://fleets.status.im/)

View File

@ -1,7 +1,7 @@
var StatusJS = require('../dist/index.js');
const StatusJS = require('../dist/index.js');
(async () => {
var status = new StatusJS();
const status = new StatusJS();
await status.connect("ws://localhost:8546", "0x0011223344556677889900112233445566778899001122334455667788990011");
console.log(await status.getPublicKey());
@ -19,7 +19,6 @@ var status = new StatusJS();
console.log("PrivMessage: " + data.payload);
});
// mail-02.gc-us-central1-a.eth.beta
const enode = "enode://015e22f6cd2b44c8a51bd7a23555e271e0759c7d7f52432719665a74966f2da456d28e154e836bee6092b4d686fe67e331655586c57b718be3997c1629d24167@35.226.21.19:30504";
@ -38,6 +37,5 @@ var status = new StatusJS();
});
});
setInterval(() => { }, 3000);
})();

View File

@ -1,4 +1,4 @@
const StatusJS = require('./dist/index.js');
const StatusJS = require('../dist/index.js');
(async () => {
const status = new StatusJS();