Allow JSON sending/receiving in websocket node

Fixes #105
This commit is contained in:
Nicholas O'Leary
2013-12-08 20:31:56 +00:00
parent f22cd381ee
commit cce5f33a97
2 changed files with 42 additions and 12 deletions

View File

@@ -96,7 +96,18 @@
<label for="node-config-input-path"><i class="icon-bookmark"></i> Path</label>
<input type="text" id="node-config-input-path" placeholder="/ws/example">
</div>
<div id="node-config-ws-tip" class="form-tips">This path will be relative to <code><span id="node-config-ws-path"></span></code>.</div>
<div class="form-row">
<label for="node-config-input-wholemsg">&nbsp;</label>
<select type="text" id="node-config-input-wholemsg" style="width: 70%;">
<option value="false">Send/Receive payload</option>
<option value="true">Send/Receive entire message</option>
</select>
</div>
<div class="form-tips">
Be default, <code>payload</code> will contain the data to be sent over, or received from a websocket.
The listener can be configured to send or receive the entire message object as a JSON formatted string.
<p id="node-config-ws-tip">This path will be relative to <code><span id="node-config-ws-path"></span></code>.</p>
</div>
</script>
<script type="text/x-red" data-help-name="websocket-listener">
@@ -107,7 +118,8 @@
RED.nodes.registerType('websocket-listener',{
category: 'config',
defaults: {
path: {value:"",required:true,validate:RED.validators.regex(/^((?!\/debug\/ws).)*$/) }
path: {value:"",required:true,validate:RED.validators.regex(/^((?!\/debug\/ws).)*$/) },
wholemsg: {value:"false"}
},
inputs:0,
outputs:0,