php - XMPP and Strophe -



php - XMPP and Strophe -

i want connect xmmp via strophe , have configured anything

i utilize wamp on scheme run localhost php

i have enabled script syntax in openfire admin

i have configured apache httpd.conf to

# xmpp proxy rule proxyrequests off proxypass /xmpp-httpbind http://127.0.0.1:7070/http-bind/ proxypassreverse /xmpp-httpbind http://127.0.0.1:7070/http-bind

also utilize basic javascript file conect server , code goes here

var bosh_service = '/xmpp-httpbind' var connection = null; function log(msg) { $('#log').append('<div></div>').append(document.createtextnode(msg)); } function rawinput(data) { log('recv: ' + data); } function rawoutput(data) { log('sent: ' + data); } function onconnect(status) { if (status == strophe.status.connecting) { log('strophe connecting.'); } else if (status == strophe.status.connfail) { log('strophe failed connect.'); $('#connect').get(0).value = 'connect'; } else if (status == strophe.status.disconnecting) { log('strophe disconnecting.'); } else if (status == strophe.status.disconnected) { log('strophe disconnected.'); $('#connect').get(0).value = 'connect'; } else if (status == strophe.status.connected) { log('strophe connected.'); connection.disconnect(); } } $(document).ready(function () { connection = new strophe.connection(bosh_service); connection.rawinput = rawinput; connection.rawoutput = rawoutput; $('#connect').bind('click', function () { var button = $('#connect').get(0); if (button.value == 'connect') { button.value = 'disconnect'; connection.connect($('#jid').get(0).value, $('#pass').get(0).value, onconnect); } else { button.value = 'connect'; connection.disconnect(); } }); });

when want connect "admin@127.0.0.1" , create authfail , after using "admin" , response :

jid: password:

strophe connecting. sent: <body rid='1613006691' xmlns='http://jabber.org/protocol/httpbind' to='admin' xml:lang='en' wait='60' hold='1' content='text/xml; charset=utf-8' ver='1.6' xmpp:version='1.0' xmlns:xmpp='urn:xmpp:xbosh'/> recv: <body xmlns='http://jabber.org/protocol/httpbind' xmlns:stream='http://etherx.jabber.org/streams' authid='2ff1799d' sid='2ff1799d' secure='true' requests='2' inactivity='30' polling='5' wait='60' hold='1' ack='1613006691' maxpause='300' ver='1.6'><stream:features><mechanisms xmlns='urn:ietf:params:xml:ns:xmpp-sasl'><mechanism>digest-md5</mechanism><mechanism>plain</mechanism><mechanism>anonymous</mechanism><mechanism>cram-md5</mechanism></mechanisms><compression xmlns='http://jabber.org/features/compress'><method>zlib</method></compression><bind xmlns='urn:ietf:params:xml:ns:xmpp-bind'/><session xmlns='urn:ietf:params:xml:ns:xmpp-session'/></stream:features></body> sent: <body rid='1613006692' xmlns='http://jabber.org/protocol/httpbind' sid='2ff1799d'><auth xmlns='urn:ietf:params:xml:ns:xmpp-sasl' mechanism='anonymous'/></body> recv: <body xmlns='http://jabber.org/protocol/httpbind'><success xmlns='urn:ietf:params:xml:ns:xmpp-sasl'/></body> sent: <body rid='1613006693' xmlns='http://jabber.org/protocol/httpbind' sid='2ff1799d' to='admin' xml:lang='en' xmpp:restart='true' xmlns:xmpp='urn:xmpp:xbosh'/> recv: <body xmlns='http://jabber.org/protocol/httpbind' xmlns:stream='http://etherx.jabber.org/streams'><stream:features><compression xmlns='http://jabber.org/features/compress'><method>zlib</method></compression><bind xmlns='urn:ietf:params:xml:ns:xmpp-bind'/><session xmlns='urn:ietf:params:xml:ns:xmpp-session'/></stream:features></body> sent: <body rid='1613006694' xmlns='http://jabber.org/protocol/httpbind' sid='2ff1799d'><iq type='set' id='_bind_auth_2' xmlns='jabber:client'><bind xmlns='urn:ietf:params:xml:ns:xmpp-bind'/></iq></body> recv: <body xmlns='http://jabber.org/protocol/httpbind'><iq xmlns='jabber:client' type='result' id='_bind_auth_2' to='pedram-pc/2ff1799d'><bind xmlns='urn:ietf:params:xml:ns:xmpp-bind'><jid>2ff1799d@pedram-pc/2ff1799d</jid></bind></iq></body> sent: <body rid='1613006695' xmlns='http://jabber.org/protocol/httpbind' sid='2ff1799d'><iq type='set' id='_session_auth_2' xmlns='jabber:client'><session xmlns='urn:ietf:params:xml:ns:xmpp-session'/></iq></body> recv: <body xmlns='http://jabber.org/protocol/httpbind'><iq xmlns='jabber:client' type='result' id='_session_auth_2' to='2ff1799d@pedram-pc/2ff1799d'/></body> strophe connected. strophe disconnecting. sent: <body rid='1613006696' xmlns='http://jabber.org/protocol/httpbind' sid='2ff1799d' type='terminate'><presence xmlns='jabber:client' type='unavailable'/></body> recv: <body xmlns='http://jabber.org/protocol/httpbind'/> strophe disconnected.

where problem ?

your log shows:

strophe connected. strophe disconnecting.

your code says:

} else if (status == strophe.status.connected) { log('strophe connected.'); connection.disconnect(); }

so… looks configured fine, , code disconnects 1 time connects…

php xmpp ejabberd strophe

Comments

Popular posts from this blog

web services - java.lang.NoClassDefFoundError: Could not initialize class net.sf.cglib.proxy.Enhancer -

Accessing MATLAB's unicode strings from C -

javascript - mongodb won't find my schema method in nested container -