[Pkg-javascript-commits] [ltx] 145/469: send_message example: wait 100ms before ending connection

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 ae4c88842de12ad0f2e1a19e632318df450e604e
Author: Astro <astro at spaceboyz.net>
Date:   Sat Sep 11 17:47:47 2010 +0200

    send_message example: wait 100ms before ending connection
---
 examples/send_message.js | 8 ++++++--
 1 file changed, 6 insertions(+), 2 deletions(-)

diff --git a/examples/send_message.js b/examples/send_message.js
index 219e3a7..a6b7a3e 100644
--- a/examples/send_message.js
+++ b/examples/send_message.js
@@ -20,8 +20,12 @@ cl.addListener('online',
 				   t(argv[4]));
 		       });
 
-		   // nodejs has nothing left to do and will exit
-		   cl.end();
+		   // 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);
 	       });
 cl.addListener('error',
 	       function(e) {

-- 
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