sstrigler / jsjac Goto Github PK
View Code? Open in Web Editor NEWJavaScript Jabber Client Library
License: Other
JavaScript Jabber Client Library
License: Other
hi,
how to find reveiving offline messages?
Thanks
Pokal4u
It will be nice to create a file with all XEPs support (with the version number) and verify if it is the last version, if not, it is the time to update ;)
I've a problem when generating custom packets in firefox (18.0.1 in this case). For example here's code that adds capabilities:
JSJaCPresence.prototype.setC = function() {
var c = this._setChildNode("c", "");
c.setAttribute('ver', "1.0");
c.setAttribute('node', "http://example.net/caps");
c.setAttribute('xmlns', "http://jabber.org/protocol/caps");
return this;
}
var p = new JSJaCPresence();
p.setC();
con.send(p);
This works fine in Chrome - it sends:
<presence xmlns="jabber:client">
<c ver="1.0" node="http://example.net/caps" xmlns="http://jabber.org/protocol/caps"></c>
</presence>
Firefox tries to send:
<presence xmlns="jabber:client">
<a0:c xmlns:a0="jabber:client" ver="1.0" node="http://example.net/caps" xmlns="http://jabber.org/protocol/caps"></a0:c>
</presence>
which gets lost on the way somewhere - I'm not getting PEP notifications I'm registered for.
There seem to be more strange namespace problems in firefox:
var iq = new JSJaCIQ();
iq.setTo(new JSJaCJID(to));
iq.setType("set");
iq.setID(id);
iq.setQuery("jabber:iq:rpc");
iq.getChild().appendChild(
iq.buildNode("methodCall", [
iq.buildNode("methodName", "foo"),
[]]));
Firefox adds a xmlns='' to methodCall which makes the receiving entity reject the packet.
Did I miss something in my code? Any idea why that happens?
Hello
I am creating chat apps..
So... while user typing message i want to fetch compose event with handler using JsJac.... Like Facebook....
Please Help!!
Thanks
Nishant
Hi again Steve, not sure if this is a bug, but I'm calling
pkt.getChild('request', 'urn:xmpp:receipts')
inside a message handler, and it is returning null with the new code inside wrapNode() in JSJaCPacket. The XML given by node.xml is
<message xmlns="jabber:client" to="webuser@localhost" from="lee@localhost/im-123456789" id="webuser-4343564342" type="chat"><body>blah</body><request xmlns="urn:xmpp:receipts"/></message>
It works with the old code (the _replaceNode() function). Any ideas?
Thanks again, Lee.
Hi,
can you explain jsjac.js sending/receiving functions flow?
how can i get user is offline/online?
some time not sending messages getting messages(attached file) in debugger (this time connection status: resume), working after 2-3 times refresh page
and if any other js errors. then jsjac connection terminated.
Thanks
Pokal4u
Hi,
Chat working good.
in config file set {loglevel, 2}. then got below error in ejabberd log?
'
You are trying to use BOSH (HTTP Bind) in host "domain.com", but the module mod_http_bind is not started in that host. Configure your BOSH client to connect to the correct host, or add your desired host to the configuration, or check your 'modules' section in your ejabberd configuration file.
and in my config file:
{modules, [ {mod_http_bind,[]} ]}
and my code:
oArgs = new Object();
oArgs.httpbase ="1.domain.com";
//oArgs.httpbase ="2.domain.com";
//oArgs.httpbase ="3.domain.com";
oArgs.timerval = 2000;
if (typeof(oDbg) != 'undefined')
oArgs.oDbg = oDbg;
con = new JSJaCHttpBindingConnection(oArgs);
setupCon(con);
oArgs = new Object();
oArgs.domain ="domain.com";
oArgs.username ="pokal4u";
oArgs.resource ="123456";
oArgs.pass ='';
con.connect(oArgs);
Please help.
Thanks
Pokal4u
Hi,
Login with same username with multiple tabs and different browsers not working, getting below error
first tab:
second tab:
my ejabbered settings:
{host_config, "public.example.org", [{auth_method, anonymous},
{allow_multiple_connections, true},
{anonymous_protocol,both }]}.
we need multiple tabs login with same username
Please help me
Thanks
Hi,
Chat working fine with poll messages normally.
if i poll 10-20 messages per second (fastly typing) get below error
session terminated:
body xmlns='http://jabber.org/protocol/httpbind' type='terminate' condition='item-not-found'
Disconneted.
Connection lost..
In my connection code:
oArgs.timerval = 2000;
In JsJac.js
JSJAC_HAVEKEYS = true;
JSJAC_NKEYS = 16;
JSJAC_INACTIVITY = 300;
JSJAC_ERR_COUNT = 10;
JSJAC_ALLOW_PLAIN = true;
JSJAC_CHECKQUEUEINTERVAL = 1;
JSJAC_CHECKINQUEUEINTERVAL = 1;
JSJAC_TIMERVAL = 2000;
//JSJAC_RETRYDELAY=5000;
// Options specific to HTTP Binding (BOSH)
JSJACHBC_MAX_HOLD = 100;
JSJACHBC_MAX_WAIT = 300;
JSJACHBC_BOSH_VERSION = "1.6";
JSJACHBC_USE_BOSH_VER = true;
JSJACHBC_MAXPAUSE = 120;
Please help
Thanks
Pokal4u
Hi,
i have installed openfire and jsjac client in same server , it works fine but i put the html code in another server and taking all the
files from jabber server, its not happening , showing some error
"An error occured:
Code: 503
Type: cancel
Condition: service-unavailable"
anything needs to change to access the jabber from other server.
Thanks
Kumar
On connect I receive roster but it does not contain information about whether user is online now or not. How can I get this information?
Hey,
It seems the DIGEST-MD5 processing function creates a Base64 hash which is not matching any of the available XMPP server verification once they got this hash.
This happens when username (maybe server domain too?) contains UTF-8 chars such as accents or even upper case chars.
As a result:
All those account succeeded using Psi+ DIGEST-MD5 auth method.
I spent some hours debugging and trying to fix & patch JSJaC but the reason of this issue is very obscure to me. I only know something is fucked up on the DIGEST-MD5 processing algorithm.
I checked hidden NULL chars (\0) but did not found any.
This bug impacts a wide range of Jappix users, that's why it's critical to us all ;)
Hello,
While Login , i can get Presence of all rosters users. //login time
However i reload my page i can not get rosters presence, // that time connection resume
/**
function handlePresence(aJSJaCPacket)
**/
@sstrigler has become available
@cstar has become available......
etc...
Please help me how to get all roster users presence , Like available or offline or away etc...
Thanks
Nishant
Howdy - I'm using JSJaC clone'd from git earlier today.
Am trying to add Facebook chat to my website.
I'm using node-xmpp-bosh as the bosh server.
I'm using NodeJS which is proxy'ing requests to node-xmpp-bosh.
So I loaded up your facebook example - I have a 'forever' access token so am not using any of your FB JS stuff - I just return my forever token from the getSession method in the FBConnection class (which is misspelled in the man JSJac class FWIW).
ANYWAYS so when I try to chat JSJaC is POST'ing to my endpoint:
I proxy this over to node-xmpp-bosh running on localhost:5280 & it returns:
Immediately - I don't think it's going to chat.facebook.com:5222.
SO... what am I doing wrong? Granted I have a very tenuous grasp of XMPP+BOSH...
thank you!!
Mark
When generating presence XML packets using JSJaCPacket, through JSJaCPresence, the XML generated by JSJaCPacket.prototype.xml is malformed if generated in IE9. For some reason, probably browser-implementation driven, many of the XML nodes in the string format contain an extra empty attribute (xmlns=""). The implementation of ejabberd I'm using interprets these extra empty attributes as invalid and returns a 400 response code and an empty body, which indicates malformed request and response. I've been able to get around this with a hack by ding string replace on this empty attribute when it shows up, but this is obviously not a good long term solution. I have an example below of the XML requests.
Malformed XML: onon
Expected XML: onon<x xmlns="http://jabber.org/protocol/muc
Hi
Can the inherit method be used to inherit a connection made in one tab over multiple tabs. I tried doing that but it gives policy-violation error. If we inherit a connection will the connection that is inherited be closed
vidit
Often needs to set multiple handlers, so it would be handy if JSJaCConnection.registerHandler would return the instance of object i.e - return this;
JSJaCHttpBindingConnection tries to inherit from JSJaCConnection on line 56:
JSJaCHttpBindingConnection.prototype = new JSJaCConnection();
but JSJaCConnection has an argument, oArg:
function JSJaCConnection(oArg) {
and it uses oArg several times in it's constructor method.
Hi!
We use JSJaC for Jappix since its inception, and I can say it is just great! But we found some bugs, I am now decided to report them all, if it can solve everyone's problems!
The first bug is that IE9 is not able to use the setXMLLang() function, because of the "xml:lang" attribute (the ":" especially), it returns nothing. I did not found any other way to set it, but another way to apply it may exists.
Here is our code modification, which is just something to avoid using it through IE9 (a try {} catch(e) {} does not work, since IE9 does not report any error): http://codingteam.net/project/jappix/browse/trunk/js/jsjac.js#line-1656
Thanks!
Valérian Saliou,
Jappix founder
When calling this line:
oPacket.getDoc().replaceChild(oPacket._importNode(node, true), oPacket.getNode());
In JSJaCPacket
We are pre-binding sessions on our server and supplying the web client the jid/rid/sid. We then use Connection.inherit() to 'resume' that session. I was wondering if such a pre-bind mechanism can be achieved with the Websocket connection as well? I see there is no 'inherit' method on the websocket connection, but maybe it can be achieved another way?
Hey guys, seems that JSJaC over WebSocket - although generally working great - doesn't call ondisconnect() when receiving a </stream:stream> packet through the WebSocket channel.
Thus, the server can never advertise a JSJaC client that its connection is closed (eg: when restarting the XMPP server or administratively closing user session).
This is equivalent to the BOSH packet.
I'm not sure if this is strictly incorrect behaviour, but thought I would bring this up as a discussion point. Are there any cases where you want the contents of the request to be duplicated in the response? I've only used iq stanzas for roster operations so far, but all that seems to be needed there is an empty iq with type='result'.
Wouldn't it be better to start with an empty iq, and just set the 'to', 'type' and 'id' attributes based on the request?
Looks like the same logic may also apply to JSJaCPacket.errorReply().
JSJaCIQ.prototype.reply
dos not update field from
Hi,
Sending messages continuously getting below error
session terminated:
body xmlns='http://jabber.org/protocol/httpbind' type='terminate' condition='item-not-found'
Please help
Srinivas
Based on the xmpp spec (http://xmpp.org/extensions/xep-0124.html#errorstatus-terminal) there are multiple terminate conditions listed in the Table 3. JSJac currently accounts only for remote-stream-error ignoring all other conditions.
Hi,
How can i get/delete queue messages?
Please help
Pokal4u
JavaScript Lint shows quite a few variables that are not being declared with the var keyword, and thus they are polluting the global space, creating the potential for naming collisions and unexpected behavior. Variables include: b64, f64, atob, btoa, attr, attribute, request, query, key, and aArg.
This was checked against code I pulled from github today for jsjac 1.3.2.
buildNode() accepts a map of keys and values. If one of these values is the Boolean value true, it becomes "-1" rather than the string "true" in the final packet, but only in Internet Explorer - specifically IE 8. Here's a small code sample:
<!DOCTYPE html>
<html>
<head>
<title></title>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<script type="text/javascript" src="lib/jsjac-1.3.4/jsjac.uncompressed.js"></script>
</head>
<body>
<div id="content">TODO write content</div>
<script type="text/javascript">
var msg = new JSJaCMessage();
msg.setBody('foo');
msg.appendNode(msg.buildNode('bar', { isBar: true, 'baz': 'quux' }));
document.getElementById('content').innerText = msg.xml();
alert(msg.xml());
</script>
</body>
</html>
http://community.igniterealtime.org/message/233316
I am unable to connect with Adium, and curl shows no issue, but JSJaC cannot connect. 401 auth issue.
Not sure wherein the issue lies or how to debug it, but will be happy to try debugging if I am told how.
If it matters, the Jabber server is at a IP address, but the domain used by the user is not at the same address. (Ie. Jabber server is at 123.45.67.89 but the user is [email protected])This was no issue for Adium, but could it be the issue here?
I am creating one web based chat application using jsjac library and ejabberd.
I am facing one problem that once user get login from any browser its work but when I am trying to login with same credentials from other window then it log outs user from previous browser and make him available on current browser.which I think not a good solution.Facebook and gmail handle such type of functionality..I need such type of functionality with jsjac and ejabberd
Hi,
I am using Js-Jac ejabberd+openfire
I am unable to connect
getting below error
code;503
type:cancel
condition:service -unavailable
Please help
Pokal4u
Hi,
Some time getting below errors ?
--> JSJaCCookieException {message: "Cookie not found", name: "CookieException"}
--> Script error. (here type='terminate' )--------> In firefox only
--> Condition: item-not-found (type="cancel")
Please help
Thanks
Srinivas
I'm trying to bind to a connection that I've already created in PHP and it's not working. (Sadly, there are no examples anywhere that I could find on how to do this.)
Every time I try to connect, firebug returns:
this._keys is null
reqstr += "key='"+this._keys.getKey()+"' ";
This is on line 4104 in the uncompressed version. The code I have to make this connection looks like this:
www.chat.attach = function (jid, sid, rid, url) {
try {
www.chat.jid = jid;
www.chat.url = url;
// get all the pieces of the jid separated
var jid_object = new JSJaCJID(jid);
www.chat.username = jid_object.getNode();
www.chat.domain = jid_object.getDomain();
www.chat.resource = jid_object.getResource();
www.chat.id = www.chat.username + '@' + www.chat.domain;
// generic args method for passing to jsjac
var args = null;
args = new Object();
args.httpbase = www.chat.url;
args.timerval = 2000;
www.chat.connection = new JSJaCHttpBindingConnection(args);
// register listeners
www.chat.connection.registerHandler('message', function () {});
www.chat.connection.registerHandler('presence', function () {});
www.chat.connection.registerHandler('iq', function () {});
www.chat.connection.registerHandler('onconnect', function () {});
www.chat.connection.registerHandler('onerror', function () {});
www.chat.connection.registerHandler('status_changed', function () {});
www.chat.connection.registerHandler('ondisconnect', function () {});
// attach to the existing session that we've been given by php
args = new Object();
args.username = www.chat.username;
args.domain = www.chat.domain;
args.resource = www.chat.resource;
args.sid = sid;
args.rid = rid;
www.chat.connection.inherit(args);
} catch (e) {
console.log(e.toString());
} finally {
return false;
}
}
Hi,
I found a little bug that I could not fix (I did not found how to stop it). It involves the connection functions, with the stream:error handler.
Here is an explanation of the bug: when I connect to a unknown XMPP host using JSJaC and node-xmpp-bosh BOSH server (which replies correctly to the connection error), JSJaC handles the "host not found" error and then send an infinite number of empty .
You can get an example here, when trying to connect to [email protected]: https://www.jappix.com/
Thanks for fixing it!
Valérian Saliou
Jappix founder
It is possible to have a XEPs and RFCs support page with version (XEP-XXXX v1.2)?
Examples:
I checked out the latest release 1.4. and saw it is quite long ago since the last update.
Master works well for me, but are there plans to fix a new release?
Hi,
Connection open in 6 tabs with different resouce , working fine
open in 7 and above tabs, sending and receiving messages are not working .
whenever close the 7 and other tabs getting all old sending and receiving messages also
in my ejabbered server
max_user_sessions : [{100,all}]
Please help
Thanks
Pokal4u
Nice work on this library. I am curious to know what kind of overlap this library has with the Strophe project found at https://github.com/metajack/strophejs ? If there is overlap, would it be beneficial to consider a convergence of the two projects?
There are some cases when ondisconnect
event is not being triggered. If we have some logged in user and then another user will log in using same credentials, then on first user side 2 event will be triggered: onStatusChanged
with session-terminate-conflict
and onerror
with error code of 503. But even if in both cases I would call JSJaCWebSocketConnection.disconnect()
- it still would to trigger ondisconnect
event so there are no one point where I can definitely say that it was disconnected.
Problem with cross-domain htpps connection to port 5281:
diff --git a/src/JSJaCHttpBindingConnection.js b/src/JSJaCHttpBindingConnection.js
index 4a4a54f..9422e97 100644
--- a/src/JSJaCHttpBindingConnection.js
+++ b/src/JSJaCHttpBindingConnection.js
@@ -164,7 +164,7 @@ JSJaCHttpBindingConnection.prototype._getRequestString = function(raw, last) {
if (xml != '' || raw != '') {
reqstr += ">" + raw + xml + "";
} else {
reqstr += "> </body>";
reqstr += "></body>";
Using JSJac 1.3.4, as best I can tell, the 'onConnect' callback in JSJacConnection is called only when login is complete and the session is established, but connected() begins returning true as soon as the initial connection has been established, at least with HttpBindingConnection. In my particular application, in order to prevent a race condition, I need to know whether the session is really established. Can either connected() be changed to reflect this, or a new method called authenticated() or sessionEstablished() or something like that be added?
I'd be happy to make the change myself but I'd have to learn github first :)
Hi,
in order to get SASL auth working with Openfire, i had to change line 369 in jsjac.js version 1.3.4 from
+'",response="'+response+'",charset="utf-8"';this.oDbg.log("response: "+rPlain,2);this._sendRaw(""
to
+'",response="'+response+'",charset="utf-8" ';this.oDbg.log("response: "+rPlain,2);this._sendRaw(""
I added a whitespace after charset="utf-8"
Im not sure if this is an JSJaC or Openfire bug, but i though i let you know as it fixed this problem for me.
Thanks for the great work with JSJac,
Florian
I am trying to send a 'gone' state stanza when user browses out the webpage, so I have attached to 'beforeunload' event a function to send the stanza. But in some scenarios it is not being sent. I was debugging inside JSJac library and I found out the stanzas are processed in time slots (timeout), and it could be the problem why this packet is not sent sometimes.
I would like to know if I can force to send a package straight away (not enqueue). Maybe it is impossible for http binding connection.
Hi, I have problems with 3G connection to xmpp server. When I try to login, status change to connecting but nothing more happens (no connection, no errors). Over WiFi connection all works well and with native apps (no web/js code) connection works.
I've got a program working great in Firefox and Chrome but in Internet Explorer 8 on Windows XP, I get an "Unspecified Error" on line 3872 (of the uncompressed version). It seems that this._req is undefined? What am I missing?
Incidentally, how do I get JSJaC to NOT delay several seconds before sending messages?
client - firefox-41.0.2
server - prosody-0.9.4-4
jsjac - latest
Firefox generates request
iq xmlns="jabber:client" type="set" from="[email protected]/oSDK-client2ce76228700" id="JSJaCID_0"><query xmlns="jabber:iq:roster"><item xmlns="" jid="[email protected]" subscription="none"/></query></iq>
and gets response
<iq type='error' to='[email protected]/oSDK-client2ce76228700' id='JSJaCID_0'><error type='modify'><bad-request xmlns='urn:ietf:params:xml:ns:xmpp-stanzas'/></error></iq>
In chromium it works correctly:
<iq xmlns="jabber:client" type="set" from="[email protected]/oSDK-client2ce76228700" id="JSJaCID_0"><query xmlns="jabber:iq:roster"><item jid="[email protected]" subscription="none"/></query></iq>
<iq type='result' to='[email protected]/oSDK-client2ce76228700' id='JSJaCID_0'/><iq type='set' id='lx14'><query xmlns='jabber:iq:roster' ver='673'><item subscription='none' jid='[email protected]'/></query></iq>
difference that firefox adds xmlns=""
to <item>
A declarative, efficient, and flexible JavaScript library for building user interfaces.
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google ❤️ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.