1
0
mirror of https://github.com/node-red/node-red-nodes.git synced 2023-10-10 13:36:58 +02:00

Further tweaks to Pusher node - now sends objects ok,

and can receive what it sends...
Also slight rearrange of edit UI to make more like other nodes.
This commit is contained in:
Dave C-J 2014-05-24 18:29:27 +01:00
parent fe0222d498
commit a320ddce23
2 changed files with 23 additions and 21 deletions

View File

@ -18,17 +18,18 @@
<script type="text/x-red" data-template-name="pusher in"> <script type="text/x-red" data-template-name="pusher in">
<div class="form-row"> <div class="form-row">
<label for="node-input-topic"><i class="icon-tasks"></i>App Key</label> <label for="node-input-channel"><i class="icon-random"></i> Channel</label>
<input type="text" id="node-input-appkey_sub" placeholder="apikey"> <input type="text" id="node-input-channel" placeholder="my_channel">
</div> </div>
<div class="form-row"> <div class="form-row">
<label for="node-input-topic"><i class="icon-tasks"></i>Channel</label> <label for="node-input-eventname"><i class="icon-tasks"></i> Event</label>
<input type="text" id="node-input-channel" placeholder="channel"> <input type="text" id="node-input-eventname" placeholder="test_event_name">
</div> </div>
<div class="form-row"> <div class="form-row">
<label for="node-input-topic"><i class="icon-tasks"></i>Event Name</label> <label for="node-input-appkey_sub"><i class="icon-lock"></i> App Key</label>
<input type="text" id="node-input-eventname" placeholder="eventname"> <input type="text" id="node-input-appkey_sub" placeholder="key">
</div> </div>
<div class="form-row"> <div class="form-row">
<label for="node-input-name"><i class="icon-tag"></i> Name</label> <label for="node-input-name"><i class="icon-tag"></i> Name</label>
<input type="text" id="node-input-name" placeholder="Name"> <input type="text" id="node-input-name" placeholder="Name">
@ -89,28 +90,28 @@
<script type="text/x-red" data-template-name="pusher out"> <script type="text/x-red" data-template-name="pusher out">
<div class="form-row"> <div class="form-row">
<label for="node-input-topic"><i class="icon-tasks"></i>App ID:</label> <label for="node-input-channel"><i class="icon-random"></i> Channel</label>
<input type="text" id="node-input-appid" placeholder="appid"> <input type="text" id="node-input-channel" placeholder="my_channel">
</div> </div>
<div class="form-row"> <div class="form-row">
<label for="node-input-topic"><i class="icon-tasks"></i>App Key:</label> <label for="node-input-eventname"><i class="icon-tasks"></i> Event</label>
<input type="text" id="node-input-appkey" placeholder="appkey"> <input type="text" id="node-input-eventname" placeholder="test_event_name">
</div> </div>
<div class="form-row"> <div class="form-row">
<label for="node-input-topic"><i class="icon-tasks"></i>App Secret:</label> <label for="node-input-appid"><i class="icon-tag"></i> App ID</label>
<input type="text" id="node-input-appsecret" placeholder="appsecret"> <input type="text" id="node-input-appid" placeholder="app_id">
</div> </div>
<div class="form-row"> <div class="form-row">
<label for="node-input-topic"><i class="icon-tasks"></i>Channel:</label> <label for="node-input-appkey"><i class="icon-lock"></i> App Key</label>
<input type="text" id="node-input-channel" placeholder="channel"> <input type="text" id="node-input-appkey" placeholder="key">
</div> </div>
<div class="form-row"> <div class="form-row">
<label for="node-input-topic"><i class="icon-tasks"></i>Even Name:</label> <label for="node-input-topic"><i class="icon-asterisk"></i> App Secret</label>
<input type="text" id="node-input-eventname" placeholder="eventname"> <input type="password" id="node-input-appsecret" placeholder="secret">
</div> </div>
<div class="form-row"> <div class="form-row">

View File

@ -45,7 +45,8 @@ var RED = require(process.env.NODE_RED_HOME+"/red/red");
socket.bind(''+this.eventname, socket.bind(''+this.eventname,
function(data) { function(data) {
var msg = {}; var msg = {};
msg.payload = data; if (data.hasOwnProperty("payload")) { msg.payload = data.payload; }
else { msg.payload = data; }
node.send(msg); node.send(msg);
} }
); );
@ -83,7 +84,7 @@ function PusherNodeSend(n) {
this.on("input", function(msg){ this.on("input", function(msg){
pusher.trigger(this.channel, this.eventname, { pusher.trigger(this.channel, this.eventname, {
"message": ""+msg.payload "payload": msg.payload
}); });
}); });