Giter Club home page Giter Club logo

jsjac's People

Contributors

afanasy avatar alertby avatar bhuztez avatar cajus avatar panepist avatar pestig avatar rraptorr avatar sstrigler avatar tekool avatar valeriansaliou avatar zash avatar zzo avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

jsjac's Issues

hi

hi,
how to find reveiving offline messages?

Thanks
Pokal4u

Firefox and namepaces

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?

Doesn't work with message receipts?

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.

jsjac.js message sending / receiving flow

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.

error

Thanks
Pokal4u

module mod_http_bind is not started in that host

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

Connection problem with multiple tabs

Hi,
Login with same username with multiple tabs and different browsers not working, getting below error

first tab:

onetab

second tab:

twotab

my ejabbered settings:

maxconn

{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

session terminated

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

Jsjac cross domain issue

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

get roster presence

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?

DIGEST-MD5 wrong hash

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

While reload page not get roster presence?

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

Facebook... ?

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

Malformed XML generated by XMLSerializer in IE9

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

Multiple tabs support

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

IE9 bug with setXMLLang()

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

Type mismatch in IE7/IE8

When calling this line:

oPacket.getDoc().replaceChild(oPacket._importNode(node, true), oPacket.getNode());

In JSJaCPacket

Websockets Prebound session

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?

Handle WebSocket stream termination

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.

503 error

I connected to openfire with JSJaC, but got a strange error.

192.168.10.110/http-bind is my openfire server,and it's ok.

image

The followings are the screenshots of errors.
image

image

JSJaCIQ.reply cloning the request

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().

Improper variable definitions polluting global space

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 creates "-1" on some non-string values in IE

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>

Unable to connect to OpenFire

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?

How to use ejabberd one user session in multiple tabs/widows

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

Connecting problem

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

Cookie not found error

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

inherit throws javascript error

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

Infinite number of requests

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

Latest release

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?

connection problem with multiple tabs

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

Strophe

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?

ondisconnect not being triggered

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.

IE 8-9 XDomainReq HTTPS

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>";
    
    }

Inconsistency between 'onConnect' and 'connected()'

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

Auth with OpenFire

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

Send 'away' status on before unload event

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.

Connection over 3G

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.

"Unspecified error" from _process

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?

In firefox doesn`t work adding users to roster.

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>

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.