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

Added INFO abour settings for xmpp. (Apologies for missing in first place...).

NOTE:... there is still a bug in the underlying simple-xmpp npm.. see
https://github.com/simple-xmpp/node-simple-xmpp/issues/12
for both the probem and the fix (not yet pulled).
This commit is contained in:
Dave C-J 2013-11-15 21:28:18 +00:00
parent 336ad7893d
commit ea398f9e66
2 changed files with 90 additions and 80 deletions

View File

@ -52,6 +52,12 @@
<p>The second output will user presence and status in <b>msg.payload</b>.</p> <p>The second output will user presence and status in <b>msg.payload</b>.</p>
<p>The <b>To</b> field is optional. If not set uses the <b>msg.topic</b> property of the message.</p> <p>The <b>To</b> field is optional. If not set uses the <b>msg.topic</b> property of the message.</p>
<p>If you are joining a room then the <b>To</b> field must be filled in.</p> <p>If you are joining a room then the <b>To</b> field must be filled in.</p>
<p>Uses the simple-xmpp module - you may also need to pre-configure your xmpp settings as per below.</p>
<p>Either add to your settings.js file...</p>
<p><pre>xmpp : { jid : "yourid", password: "password" },</pre></p>
<p>Or create a file xmppkeys.js containing</p>
<p><pre>module.exports = { jid: "yourid", password: "password" }</pre></p>
<p>This <b>must</b> be located in the directory above node-red.</p>
</script> </script>
<script type="text/javascript"> <script type="text/javascript">

View File

@ -108,10 +108,14 @@ function XmppNode(n) {
this.on("close", function() { this.on("close", function() {
xmpp.setPresence('offline'); xmpp.setPresence('offline');
//xmpp.conn.end(); try {
xmpp.disconnect();
// TODO - DCJ NOTE... this is not good. It leaves the connection up over a restart - which will end up with bad things happening... // TODO - DCJ NOTE... this is not good. It leaves the connection up over a restart - which will end up with bad things happening...
// (but requires the underlying xmpp lib to be fixed (which does have an open bug request on fixing the close method)). // (but requires the underlying xmpp lib to be fixed, which does have an open bug request on fixing the close method - and a work around.
// see - https://github.com/simple-xmpp/node-simple-xmpp/issues/12 for the fix
} catch(e) {
this.warn("Due to an underlying bug in the xmpp library this does not disconnect old sessions. This is bad... A restart would be better."); this.warn("Due to an underlying bug in the xmpp library this does not disconnect old sessions. This is bad... A restart would be better.");
}
}); });
} }