[Pkg-javascript-commits] [ltx] 147/469: send_message example: undo delay before end(); indentation
Jonas Smedegaard
dr at jones.dk
Wed Aug 31 13:01:17 UTC 2016
This is an automated email from the git hooks/post-receive script.
js pushed a commit to branch master
in repository ltx.
commit 2afcd1f02ec2cf65666a5302a772ece70245b529
Author: Astro <astro at spaceboyz.net>
Date: Sun Sep 12 00:43:01 2010 +0200
send_message example: undo delay before end(); indentation
5001cf1067974ff5e07478d5f510e60ce4cc7233 changes connection in that it
should wait to receive </stream:stream> after sending the closing tag
itself and before socket.end(). Some servers (Tigase 5.1.0?) still seem
to swallow the messages send before. This might be a race condition in
their code. It works with ejabberd.
---
examples/send_message.js | 38 +++++++++++++++++---------------------
1 file changed, 17 insertions(+), 21 deletions(-)
diff --git a/examples/send_message.js b/examples/send_message.js
index a6b7a3e..85040ba 100644
--- a/examples/send_message.js
+++ b/examples/send_message.js
@@ -8,27 +8,23 @@ if (argv.length < 6) {
}
var cl = new xmpp.Client({ jid: argv[2],
- password: argv[3] });
+ password: argv[3] });
cl.addListener('online',
- function() {
- argv.slice(5).forEach(
- function(to) {
- cl.send(new xmpp.Element('message',
- { to: to,
- type: 'chat'}).
- c('body').
- t(argv[4]));
- });
+ function() {
+ argv.slice(5).forEach(
+ function(to) {
+ cl.send(new xmpp.Element('message',
+ { to: to,
+ type: 'chat'}).
+ c('body').
+ t(argv[4]));
+ });
- // if we end too soon, the server will close the
- // connection before handling our message
- setTimeout(function() {
- // nodejs has nothing left to do and will exit
- cl.end();
- }, 100);
- });
+ // nodejs has nothing left to do and will exit
+ cl.end();
+ });
cl.addListener('error',
- function(e) {
- sys.puts(e);
- process.exit(1);
- });
+ function(e) {
+ sys.puts(e);
+ process.exit(1);
+ });
--
Alioth's /usr/local/bin/git-commit-notice on /srv/git.debian.org/git/pkg-javascript/ltx.git
More information about the Pkg-javascript-commits
mailing list