-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathzyre-shout.html
82 lines (77 loc) · 3.12 KB
/
zyre-shout.html
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
<script type="text/javascript">
RED.nodes.registerType('zyre-shout', {
category: 'Zyre',
color: '#a6bbcf',
defaults: {
name: {
value: 'shout',
required: true
},
topic: {
value: ''
},
zyre: {
value: '',
type: 'zyre-peer',
required: true
},
output: {
value: 'json',
required: true
}
},
inputs: 1,
outputs: 1,
icon: 'zeromq.png',
label: function () {
return this.name || 'zyre-shout'
}
})
</script>
<script type="text/html" data-template-name="zyre-shout">
<div class="form-row">
<label for="node-input-zyre"><i class="fa fa-server"></i> Zyre Peer</label>
<select id="node-input-zyre"></select>
</div>
<div class="form-row">
<label for="node-input-name"><i class="fa fa-tag"></i> Name</label>
<input type="text" id="node-input-name" placeholder="Name">
</div>
<div class="form-row">
<label for="node-input-topic"><i class="fa fa-tasks"></i> Topic</label>
<input type="text" id="node-input-topic" placeholder="Topic">
</div>
<div class="form-row">
<label for="node-input-output"><i class="fa fa-map"></i> Output</label>
<select id="node-input-output">
<option value="buffer">a binary Buffer</option>
<option value="string">a String if possible</option>
<option value="json">a JSON object if possible</option>
</select>
</div>
</script>
<script type="text/html" data-help-name="zyre-shout">
<p>Get notified when a peer shouts to a group, or send a shout to a group on the Zyre network.</p>
<h3>Inputs</h3>
<dl class="message-properties">
<dt>topic <span class="property-type">string</span></dt>
<dd>The name of the group to shout to. Leave blank to pass <code>msg.topic</code>.</dd>
<dt>payload <span class="property-type">object | string | buffer</span></dt>
<dd>The payload of the message to send.</dd>
</dl>
<h3>Outputs</h3>
<dl class="message-properties">
<dt>topic <span class="property-type">string</span></dt>
<dd>The name of the group.</dd>
<dt>identity <span class="property-type">string</span></dt>
<dd>The identity of the peer that sent the message.</dd>
<dt>name <span class="property-type">string</span></dt>
<dd>The name of the peer that sent the message.</dd>
<dt>payload <span class="property-type">object | string | buffer</span></dt>
<dd>The payload of the received message.</dd>
</dl>
<h3>Details</h3>
<p><code>msg.payload</code> is used as the payload of the shout. If it contains an Object, it will be converted to a JSON string before being sent. If it contains a binary Buffer, the message will be sent as-is.</p>
<p>This node outputs a message when a peer shouts to a group that this peer has joined. The payload can be converted to a JSON object or a string as desired. If a binary Buffer is selected and "raw" is set as the <code>encoding</code> (in the zyre peer config node), the payload will be a binary Buffer.</p>
<p>When the topic is populated, this node only outputs messages for that group. This can be used to filter input to a connected node.</p>
</script>