JSJaC 1.0 Beta1

A first beta release of JSJaC 1.0 is available now. What’s new with this release?

  • Full API documentation by use of JSDoc.
  • Integrated DOM Builder, taken from script.aculo.us. Building your own XML nodes within a packet is now as easy as

    var iq = new JSJaCIQ();
    iq.appendNode('query', {xmlns: 'jabber:iq:private'},
    [['storage', {xmlns: 'storage:rosternotes'},
    ['note', [jid: 'romeo@shakespeare.lit', cdate: '2004-09-24T15:23:21Z', mdate: '2004-09-24T15:23:21Z'},['Oh my sweetest love ...']]]]);
  • A ConsoleLogger to be used for debug logging instead of ye old JSDebugger. Works with Firefox’ Firebug extension, Safari and Opera.
  • A new type JSJaCJID for easier handling of JIDs.
  • Even more stuff to be found at the ChangeLog.

Now where to get it? JSJaC is now available as a single, compressed file by use of jsmin.

Get it here: JSJaC 1.0beta1

Of course there are still packaged versions available:

Last but not least there’s a tag in JSJaC’s subversion repository:

svn co http://svn.stefan-strigler.de/jsjac/tags/jsjac_1.0beta1

As always please make sure to have a look at the README first if you’ve got questions.

Being a beta release giving feedback is even more encouraged as usually.

46 Responses to JSJaC 1.0 Beta1


  1. Comment by Philippe Sultan | 2007/07/10 at 18:30:14

    There’s a typo in JSJaCConnection.js, line 703 (‘Dbg’ instead of ‘Dgb’). Also, the authentication failure information cannot be displayed on the webpage, as there is no handler for the tag. Is there a way to work around this, or something I missed?

    Thanks for this new realease Stefan, keep up the good work 🙂

  2. Comment by Raptor | 2007/07/23 at 14:41:19

    Will there be an update to jwchat too? 🙂

  3. Comment by Steve | 2007/07/30 at 10:03:28

    Philippe, thanks for reporting, the bug is fixed in latest SVN revisions now. But what do you mean with “there’s no handler for the tag”?

    Raptor, yes there will be a new release to JWChat but I can’t tell when, sorry for that.

  4. Comment by Markus Held | 2007/07/30 at 15:31:54

    Hi, this looks really cool and could be of benefit for very many projects.
    Steve, is it possible that JSJaC has got problems with Openfire as Jabber Server? I’m trying the simple client app example with the JabberHTTPBind1.0 servlet within tomcat, but I keep getting “func: JSJaCHBCHandleInitialResponse no body element or incorrect body in initial response” messages.

  5. Comment by Steve | 2007/07/30 at 15:37:59

    Markus, actually there shouldn’t be a problem using jsjac with JabberHTTPBind and Openfire. But if you’re using Openfire there’s no reason to use JabberHTTPBind as Openfire comes with its own HTTP Binding service built-in.

  6. Comment by Markus Held | 2007/07/30 at 15:47:43

    Steve, thanks for the quick response. I’ve tried that and gotten
    [Exception… “Component returned failure code: 0xc1f30001 (NS_ERROR_NOT_INITIALIZED) [nsIXMLHttpRequest.send]” nsresult: “0xc1f30001 (NS_ERROR_NOT_INITIALIZED)” location: “JS frame :: http://localhost:8080/ajax/jsjac_1.0beta1/examples/simpleclient.html :: anonymous :: line 0″ data: no]

    Probably I’m making one very silly mistake somewhere…

  7. Comment by Steve | 2007/07/30 at 15:57:19

    What are you using as http base address for the http binding service? It must be on the same domain and port as simpleclient.html, thus it must be at http://localhost:8080/someuri

  8. Comment by Markus Held | 2007/07/30 at 16:08:34

    I first tried http://localhost:8080/JabberHTTPBind1.0 as a http base address. I then tried Openfire’s http bind feature, using 8081 as the port, since tomcat uses port 8080 – thus setting http base to http://localhost:8081

  9. Comment by Steve | 2007/07/30 at 16:19:06

    Markus, as I said before: http base must be local to simpleclient.html, thus either try to serve simpleclient.html (and jsjac) from within openfire (if that’s possible) or configure apache to redirect from say http://localhost:8080/http-bind/ to http://localhost:8081. To do so load module mod_rewrite, mod_proxy and mod_proxy_http and a lines like

    RewriteEngine On
    RewriteRule ^/http-bind/ http://localhost:8081/ [P]

    to your httpd.conf

  10. Comment by Markus Held | 2007/07/31 at 10:31:19

    Thanks for your earlier hints. The apache url rewrite seems to work, but openfire keeps on throwing exceptions of the form:

    javax.security.sasl.SaslException: DIGEST-MD5: digest response format violation. Incompatible charset value: utf-8��
    at com.sun.security.sasl.digest.DigestMD5Server.validateClientResponse(Unknown Source)
    at com.sun.security.sasl.digest.DigestMD5Server.evaluateResponse(Unknown Source)
    at org.jivesoftware.openfire.net.SASLAuthentication.handle(SASLAuthentication.java:281)

    It seems like other people have similar problems (see http://www.igniterealtime.org/forum/thread.jspa?threadID=24383), only that I’m getting 2 unreadable characters instead of 3 after “utf-8”.

  11. Comment by Steve | 2007/07/31 at 10:38:34

    Markus, which browser are you using? I’ve been trying out Openfire myself yesterday with success. I’ve been using Firefox 2.0.3

  12. Comment by Markus Held | 2007/07/31 at 10:43:39

    Steve, it’s Firefox I’ll try an update right now.

  13. Comment by Markus Held | 2007/07/31 at 10:53:37

    It’s Firefox now. I’ve also tried IE 6.0 and Opera 9.22. Still the same thing.

  14. Comment by Steve | 2007/07/31 at 11:19:06

    Which version of Openfire are you using? I’m using 3.3.2.

    (PS: Of course I was wrong, I’m not using Firefox 2.0.3, it’s 2.0.05)

  15. Comment by Markus Held | 2007/07/31 at 11:20:07

    It’s also 3.3.2.

  16. Comment by Steve | 2007/07/31 at 11:32:49

    Maybe it’s a problem with apache forwarding the requests then? You could try serving your pages directly from Openfire. To do so copy jsjac’s files to openfire/resources/spank and point your browser to http://localhost:8080/examples/simpleclient.html. HTTP Base has to be set to /http-bind/ then.

  17. Comment by Markus Held | 2007/07/31 at 11:44:48

    It’s a good idea, but it doesn’t work. It’s still the same problem.

  18. Comment by Steve | 2007/07/31 at 13:00:01

    OK, next question: Which version of Java are you using. The exception you’ve posted seems to be related to some third party library (javax.security).

    Here’s what I’m using:

    $ java -version
    java version “1.6.0”
    Java(TM) SE Runtime Environment (build 1.6.0-b105)
    Java HotSpot(TM) Client VM (build 1.6.0-b105, mixed mode, sharing)

  19. Comment by Markus Held | 2007/07/31 at 13:32:38

    I’ve used JRE 1.6.0-beta2-b86 and just gotten the latest JRE from SUN (1.6.0_02-b06). It’S still the same thing, though.

  20. Comment by Markus Held | 2007/07/31 at 18:09:02

    Apparently there’s a bug in the Base64 encoder, so I’ve taken another one. The authentication itself is working now. However, the next message is responded with an HTTP 400 error. The client seems to be able to send and receive messages, though.

  21. Comment by Steve | 2007/07/31 at 18:18:33

    Yes I’ve noticed this behavior too, seems to be a bug in Openfire but jsjac works nonetheless.

  22. Joe
    Comment by Joe | 2007/08/02 at 00:17:30

    Have you considered Jabber XCP as your server? the jabber inc guys have http binding figured out. jabber xcp has scaled beyond 1 million concurrent users on minimal hardware

  23. Comment by Steve | 2007/08/02 at 09:55:49

    Actually a very good reason for not using Jabber XCP is that it’s not OpenSource 🙂

  24. Comment by A Miller | 2007/08/03 at 01:46:38

    This new release is very good news. Cheers. I have a question related to using some url binding features from the dojo toolkit alongside JSJaC — it seems that while JSJaC is connected on a binding interface, trying to open other xmlHttp connections fail with an Exception of
    “‘Permission denied to call method XMLHttpRequest.open’ when calling method: [nsIDOMEventListener::handleEvent]” nsresult: “0x8057001e (NS_ERROR_XPC_JS_THREW_STRING)” location: “” data: no]

    I know that this is usually a security error or sandbox error, but in this case, the xmpp connection works fine independently, and my other ajax connections work fine independently as well. It’s only when the two are happening at the same time that I get the exception. My question for you is this: do I need to extend the JSJac lib in order to route my other ajax calls through its event handling queue? Or is there some less hacky way to get them to all cooperate? Is this a known issue with xmlhttprequest — for example not allowing simulataneous connections, or is it posibly dojo-related? Should I try using Prototype? Any suggestions from anyone would help, as I’ve run into this issue late in this project and it’s very frustrating to realize it now.


  25. Comment by Steve | 2007/08/03 at 09:13:35

    Aaron, most browsers are limited to allow two XmlHttpRequests two the same domain (and port) concurrently. JSJaC makes use of both. Thus a possible solution is to address some different subdomains for jsjsac (http-binding) and your other ajax calls.

    Cheers, Steve

  26. Comment by John K Grytten | 2007/08/06 at 10:52:14

    Hi, I’m trying to get simpleexample from JSJaC 1.0 Beta1 to work with Openfire 3.3.2. I’ve tried to configure apache (2.2.4) as suggested, but Firebug reports “auth error: failure xmlns=”urn:ietf:params:xml:ns:xmpp-sasl”>” and “SASL Digest-MD5: server repsonse with wrong rspauth”.

    Do you have any suggestion on how I should proceed in order to debug this? Any help would be appreciated.

    John K.

  27. Comment by David Neubauer | 2007/08/10 at 00:56:28

    Same MD5 format failure with OpenFire. JWChat works just fine however on exact same setup.

    2007.08.09 15:48:29 SaslException
    javax.security.sasl.SaslException: DIGEST-MD5: digest response format violation. Incompatible charset value: utf-8
    at com.sun.security.sasl.digest.DigestMD5Server.validateClientResponse(Unknown Source)
    at com.sun.security.sasl.digest.DigestMD5Server.evaluateResponse(Unknown Source)
    at org.jivesoftware.openfire.net.SASLAuthentication.handle(SASLAuthentication.java:281)
    at org.jivesoftware.openfire.SessionPacketRouter.route(SessionPacketRouter.java:64)
    at org.jivesoftware.openfire.http.HttpSession.sendPendingPackets(HttpSession.java:429)
    at org.jivesoftware.openfire.http.HttpSessionManager$HttpPacketSender.run(HttpSessionManager.java:311)
    at java.util.concurrent.ThreadPoolExecutor$Worker.runTask(Unknown Source)
    at java.util.concurrent.ThreadPoolExecutor$Worker.run(Unknown Source)
    at java.lang.Thread.run(Unknown Source)

    What version of jsjac is jwchat using right now? Can i get a copy of that one?


  28. Comment by David Neubauer | 2007/08/10 at 01:42:04

    Quick fix so you can continue developement and testing while they work out the md5 format issue or lack there of or whatever.

    // setup args for connect method
    oArgs = new Object();
    oArgs.domain = aForm.server.value;
    oArgs.username = aForm.username.value;
    oArgs.resource = ‘jsjac_simpleclient’;
    oArgs.pass = aForm.password.value;
    oArgs.register = aForm.register.checked;
    oArgs.authtype = “nonsasl”;

  29. Comment by Sabine Dinis Blochberger | 2007/08/10 at 11:55:10

    Were there API changes? A list of that would be very helpful.

    We have a customized JwChat running, and maybe we want to update (althought it’s working Ok).. I would want wait if the API changed again, as I haven’t touched it in a while.

  30. Comment by Steve | 2007/08/10 at 12:01:59

    The changes I made should all be backwards compatible with the last version (0.6.1). Anyway, there will be a new release (beta2 or maybe final) too so please wait. beta1 got some serious bugs that prevented it from working with MSIE.

  31. Comment by John | 2007/08/12 at 16:12:12

    jsjac looks great.

    Can I transfer files between two javascript clients with it?
    Can users upload pictures for their profiles(avatar)?

    John F.

  32. Comment by Steve | 2007/08/13 at 09:25:39

    John, JSJaC can’t transfer files or upload images natively as it’s restricted by limitations implied by JavaScript. For this kind of stuff you’d need some additional jabber/xmpp component (speaking of a service of the jabber/xmpp network) that translates image uploads to jabber/xmpp bytestreams (and vica versa).

    Cheers, Steve

  33. Comment by John | 2007/08/13 at 13:14:00

    Hi Steve,

    I think bytestreams might work in FF but not sure about IE.
    Are you familiar with such a component in openfire?

    If I understand correctly, jsjac supports json syntax.
    Do you know if openfire supports json as well so we all don`t have to worry about cross domain security?

    Thanks you for your answer.

    John F.

  34. Comment by Steve | 2007/08/13 at 13:25:09

    Well maybe the term bytestream was somewhat missleading. The problem is that you cannot access local data (data on your computer) from within javascript that’s not being loaded from local but from the net.

    If you want to write such a component (or service) this wouldn’t need to be related to OpenFire if you’re using the jabber component protocol for connecting this service to your server.

    JSJaC doesn’t support JSON syntax, I don’t know about OpenFire.

    Cheers, Steve

  35. Comment by John | 2007/08/27 at 00:54:58

    Hi Steve,

    I`m investigating your simpleclient example.
    When I`m trying to send messages the client sends them immediately
    but when I`m receiving messages jsjac waits for 5 seconds before it askes for another connection.
    Can you explain please why are you doing that?
    Is this part of the BOSH protocol?

    John F.

  36. Comment by Steve | 2007/08/27 at 09:12:01

    John, this is caused by some missunderstanding of an old version of HTTP Binding. Thus you can regard it as being a bug. The next release will fix this but unfortunately there are server side implementations of BOSH (HTTP Binding) which have the same bug (namely current versions of OpenFire) which will lead to incompatibilities. I’m pretty sure they’ll fix this too ASAP.

    Cheers, Steve

  37. Comment by Johm | 2007/08/27 at 14:25:48

    Steve, thank you for your answer it explains allot. I do use OpenFire.

    What about other delays or restrictions?
    Is there a limit on how frequently can a client send requests to the server?
    Do I need some small delay between requests or can I just send them whenever I want.

    I do aware of it being an extreme case but I want to be aware of all the limitations.

    John F.

  38. Comment by Steve | 2007/08/27 at 14:39:09

    Well, there is this session variable ‘polling’ which tells how many seconds a client has to wait before it may send another empty request. BUT this only holds for sessions that are in polling modes, i.e. which has the attribute ‘hold’ set to 0. If you want to know details please have a look at XEP-0124, esp. at section 11 (“Overactivity“).

  39. Comment by John | 2007/08/30 at 13:40:25

    Steve, Openfire just doesn`t work properly with http-bind and I`m certain that jsjac works fine.
    Except for the delay of 5 second client A sometimes gets messages from client B one by one only when he sends messages himself. I`ve tried to ask in their forum but they just don`t answer.
    Maybe you know when they are planning to fix it?

    Are you familiar with another server that implement BOSH? I`ve tried ejabberd but couldn`t install the http-bind module on Windows.

    Thanks and I`m sorry if I`m drifting of the main subject. I`m looking for a server as wonderful as your client…

    John F.

  40. Comment by Steve | 2007/08/30 at 13:50:51

    I don’t know about OpenFire, I’m not involved in development or such. We’re using ejabberd here at mabber.com with great success. If you could give me your version number I can send you the required files. An alternative is to use my Java Servlet which is available at http://zeank.in-berlin.de/jhb/. This one lets you connect to any Jabber server you want.

  41. Comment by John | 2007/08/30 at 14:23:02

    I`m using the latest windows installer of ejabberd – 1.1.3. It will be wonderful if you could send me the files. If I need some further steps for compilation and install I`ll appreciate if you could note them as well. I tried to compile the http-bind module on SVN as instructed on the ejabberd site but couldn`t do it.
    In what folder should I put jsjac to aviod cross domain problems? your advice on the spank folder on OpenFire works great.
    I`ve heard talks that proxy might affect performance. Is it true regarding your Java Servlet as well?

    My mail: dolittle919@yahoo.com

    I couldn`t thank you enough

    Best, John F.

  42. Comment by Steve | 2007/08/31 at 09:31:03

    … replied to john by mail

  43. Comment by Jignesh Jani | 2007/11/09 at 16:23:54

    I am very new to this area. can you please suggest me what all i will need to use jsJac polling mechanism. I will be using IIS as my web server. Can you please tell me what all components i will need to make it work. Currently i am not able to make it work… Thanks in anticipation of help.

  44. Comment by Jack Straw | 2008/01/15 at 20:05:14

    I’m confused between ‘server’ and ‘http_base’. If I have a Windows machine called ‘kmgx620’, but a JBoss app server running at ‘http://localhost:8080’ and an ejabberd instance on port 5280 (ejabberd@localhost), what do I use for ‘server’ and ‘http_base’?

    Also, I understand a proxy may be needed here. I can’t find where and how to configure that for JBoss. (Probably out of scope here, but just thought I’d ask if you knew.)


  45. Comment by zhang gang | 2008/06/02 at 12:49:36

    the error when jwchat work with openfire:
    javax.security.sasl.SaslException: DIGEST-MD5: digest response format violation. Incompatible charset value: utf-8��

    because function JSJaCSASLAuthDigestMd5S1 in jsjac.js

    var rPlain = “username=\”” + this.username + “\”,realm=\”” + this.domain + “\”,nonce=\”” + this._nonce + “\”,cnonce=\”” + this._cnonce + “\”,nc=\”” + this._nc + “\”,qop=auth,digest-uri=\”” + this._digest_uri + “\”,response=\”” + response + “\”,charset=utf-8″;

    charset=utf-8 should be charset=\”utf-8\”

Trackbacks & Pingbacks »»

  1. Trackback by a little bit of zeank | 2007/09/04 at 11:00:11

    JSJaC v1.0 is out…

    I’m proud to announce the release of JSJaC v1.0, a JavaScript library for implementing web based Jabber/XMPP clients using either XMPP Over BOSH or the somewhat outdated HTTP Polling for communicating with Jabber servers.
    New with this release is…

Comments are closed