我想匿名登录Openfire Server。我尝试过使用null用户名和密码但无法登录。我在客户端使用了Strophe。请帮助我并提出任何建议。提前谢谢..
答案 0 :(得分:0)
首先从openfire管理面板添加此类属性 xmpp.auth.anonymous true
假设您的域名是test.com
var c = new Strophe.Connection("/http-bind/"); //if localhost
c.connect("test.com",null,function(constatus){
console.log(constatus);
if(constatus==5){//connected
c.addHandler(function(message){console.log(message);}, null, "message", "chat");
c.send($pres());
}
});
这一切都在客户端!
我已经实现了PacketInterceptor来查看所有数据包
public void interceptPacket(Packet packet, Session session, boolean incoming, boolean processed) throws PacketRejectedException {
if(packet instanceof Presence){
Presence presence = (Presence) packet;
log.info("Presence:"+presence.toXML());
Message msg = new Message();
msg.setType(Type.chat);
msg.setFrom("admin@test.com");
msg.setBody("Hello from server");
session.process(msg);
}
}