当前位置: 首页 > 工具软件 > xmpp-go > 使用案例 >

BoSH-XMPP-webchat

岳正阳
2023-12-01

Always,你总会遇到这样那样的问题,关键是看你的解决问题的历史经验,以及快速学习的能力,是哦。 so quick so fast but should keep learning。 


Section ONe

Conversejs怎么用的?https://github.com/jcbrand/converse.js

1) login Google talk with account1@gmail.com

2) then login  account2@gmail.com  on Conversejs.org website demo
3) account1 and account2 are friends
4) account1 send a message "aaa" to account2, then account receive it;

however, after account2 sending a message to account1, account1 CAN NOT receive it.

====can‘t login

where should i go to look? it will be very helpful to me and others.
when click the login button, which function will be executed firstly?

btw, i downloaded Conversejs and deployed it on httpServer of node.js. Conversejs client can connect the jabber.org (xmpp server) successfully. and

1) i set up my xmpp server -- openfire, and its BOSH url is http://192.168.1.100:7070/http-bind/ ;

2) then i config bosh_service_url: 'http://localhost:7777/http-bind/' in the main.js

3) i write a http proxy like that:
app.post('/http-bind/', function(req, res){
var proxy_req = http.request(
{ host: 192.168.1.100,
port:7070,
path:/http-bind/,
method: req.method,
headers: req.headers
});
//some event listeners
req.on('data', function(){ ....... });
});

Everything that posted to http://localhost:7777/http-bind/ will be posted to http://192.168.1.100:7070/http-bind/.

then i click the login button. it starts to do some http requests. most of the time, the first and second requests have normal responses. But, the third request fails, saying "Aborted".finally, login failed.

problem mentioned above: conversejs cannot login my openfire server).

1) I modify the bosh_service_url: 'http-bind/' in main.js, then run the command: r.js -o build.js

2) fix a bug in my http proxy code. proxy code is written in node.js:

//proxy handler
var proxy_handler = function(req,res){
var proxy_request = http.request({
host: bosh_host,
port: bosh_port,
path: bosh_path,
method: req.method,
headers: req.headers
});
proxy_request.on('response', function(proxy_response) {
proxy_response.on('data', function(chunk) {
res.write(chunk, 'binary');
});

proxy_response.on('end', function() {
res.end();
});
res.writeHead(proxy_response.statusCode, proxy_response.headers);
});
req.on('data', function(chunk) {
proxy_request.write(chunk, 'binary');

    console.log(chunk.toString());
});
req.on('end', function() {
    proxy_request.end();
});
req.on('error',function(e){
    console.log(e);
});

}
//router
app.get('/',function(req,res){
res.sendfile(__dirname+'/index.html');

});
app.post('/http-bind/',proxy_handler);

3) add a resouce in the jid when i login. such as, account@mydomain.com/resource

converse.js doesn't give a default/random resource name when a user login without any resource


https://github.com/jcbrand/converse.js/releases

how to start : https://conversejs.org/docs/html/index.html#quickstart-to-get-a-demo-up-and-running

===没有搞清楚,那个登陆是不是需要加上啊?

Section two

New Features in 0.6

This is the second release of Apache Vysper. Updates since the last release includes afull implementation of BOSH, improvements to the MUC implementation and many smaller changes.

This release contains partial implementations of the following specifications:

  • RFC 3920 XMPP Core
  • RFC 3921 XMPP IM
  • XEP-0045 Multi-user chat
  • XEP-0060 Publish-subscribe
  • XEP-0124 Bidirectional-streams Over Synchronous HTTP (BOSH)
  • XEP-0206 XMPP Over BOSH
svn co http://svn.apache.org/repos/asf/mina/vysper/tags/0.6</SPAN>

why bosh

http://metajack.im/2008/09/08/which-bosh-server-do-you-need/

BOSH messages as well as database logging of all chat messages. When Piding lost the connection and created a new one however, the message was resent, and the message got through. I then also received pending messages from others. 


opkode.im

===

736121c26118a6dfa896c09d878308fe86c1b18113-Sep-2010Bernd FondermannVYSPER-250, VYSPER-251:
greatly simplify spring xml configuration + add optional BOSH configuration to spring config
improve sample app to connect to specific web app context path, default is '/'
make bosh endpoint easy to subclass, add a subclass for adding parallel web apps besides BOSH



git-svn-id: https://svn.apache.org/repos/asf/mina/vysper/trunk@996553 13f79535-47bb-0310-9956-ffa450edef68


 类似资料: