Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

addHandler issue on message #119

Open
darshanopenxcell opened this issue Aug 11, 2015 · 2 comments
Open

addHandler issue on message #119

darshanopenxcell opened this issue Aug 11, 2015 · 2 comments

Comments

@darshanopenxcell
Copy link

Hi,

I am getting XML request but not getting message in addHandler message.

connection.addHandler(onMessage, null, 'message', null, null, null);
connection.send($pres().tree());

Message not come in this function function.
But i can see response from /http-bind/ like

hello

Please help me,
Thanks.

@Gordin
Copy link

Gordin commented Aug 11, 2015

Please open issues in this repository instead: https://github.com/strophe/strophejs
this repository is not maintained any more

Also, you will have to be more precise with your issue.
How does the XML message look like?
Are these two lines actually after another this in the code? Then there is no reason why onMessage should be called.

@darshanopenxcell
Copy link
Author

XML message like

<body xmlns='http://jabber.org/protocol/httpbind'><message xmlns="jabber:client" to="[email protected]" from="[email protected]/78950f38" type="chat"><body>hello</body></message></body>

I am getting message in onMessage function and this function like this..

function onMessage(msg) {
    var to = msg.getAttribute('to');
    var from = msg.getAttribute('from');
    var type = msg.getAttribute('type');
    var elems = msg.getElementsByTagName('body');
        if (type == "chat" && elems.length > 0) {
        var body = elems[0];
        var nmsg = Strophe.getText(body);
        }
}

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants