mirror of
https://github.com/embarklabs/embark.git
synced 2025-01-11 14:24:24 +00:00
update readme
This commit is contained in:
parent
0b73194e12
commit
a8beb1bf8c
@ -366,7 +366,7 @@ then set the provider:
|
||||
**listening to messages**
|
||||
|
||||
```Javascript
|
||||
EmbarkJS.Messages.listenTo({topic: ["achannel", "anotherchannel"]}).then(function(message) { console.log("received: " + message); })
|
||||
EmbarkJS.Messages.listenTo({topic: ["topic1", "topic2"]}).then(function(message) { console.log("received: " + message); })
|
||||
```
|
||||
|
||||
**sending messages**
|
||||
@ -374,15 +374,17 @@ then set the provider:
|
||||
you can send plain text
|
||||
|
||||
```Javascript
|
||||
EmbarkJS.Messages.sendMessage({topic: "achannel", data: 'hello world'})
|
||||
EmbarkJS.Messages.sendMessage({topic: "sometopic", data: 'hello world'})
|
||||
```
|
||||
|
||||
or an object
|
||||
|
||||
```Javascript
|
||||
EmbarkJS.Messages.sendMessage({topic: "achannel", data: {msg: 'hello world'}})
|
||||
EmbarkJS.Messages.sendMessage({topic: "sometopic", data: {msg: 'hello world'}})
|
||||
```
|
||||
|
||||
note: array of topics are considered an AND. In Whisper you can use another array for OR combinations of several topics e.g ```["topic1", ["topic2", "topic3"]]``` => ```topic1 AND (topic2 OR topic 3)```
|
||||
|
||||
Tests
|
||||
======
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user