我已经设置了一个XMPP服务器,我已经创建了登录表单.PHP和HTML.我之前没有这样做,我想知道如何通过PHP连接到XMPP服务器,就像使用PHP连接到MySQL一样.
我的问题:我正在通过Android和iOS上的XMPP进行文件传输到Spark客户端(Spark 2.6.3).我在android上成功完成了这个(由于很好的库),但还没有在iOS上取得成功.但是,在这两个设备上我都注意到传输因字节流而失败......
<error code="404" type="CANCEL"><item-not-found xmlns="urn:ietf:params:xml:ns:xmpp-stanzas"/><text xmlns="urn:ietf:params:xml:ns:xmpp-stanzas" xml:lang="en">Could not establish socket with any provided host</text></error>
Run Code Online (Sandbox Code Playgroud)
在Android上,传输通过诉诸ibb完成...
<iq id="DK1IO-19" to="myUsername@beta.myCompany.co.uk/Spark 2.6.3" type="set"><open xmlns="http://jabber.org/protocol/ibb" block-size="4096" sid="jsi_4740809287923906297" stanza="iq"/></iq>
Run Code Online (Sandbox Code Playgroud)
此外,在Android上,当我从Spark发送文件到我的Android应用程序时,它似乎通过bytesreams正常工作.
因此在iOS上我必须自己编写ibb连接,但为什么字节流首先会失败呢?
完整日志(Android应用程序):
05-15 13:42:04.023: I/System.out(523): 01:42:04 PM RCV (1093423288): <iq id="DK1IO-9" to="myUsername@beta.myCompany.co.uk/123" from="friendsUsername@beta.myCompany.co.uk/Spark 2.6.3" type="result"><si xmlns="http://jabber.org/protocol/si"><feature xmlns="http://jabber.org/protocol/feature-neg"><x xmlns="jabber:x:data" type="submit"><field var="stream-method"><value>http://jabber.org/protocol/bytestreams</value><value>http://jabber.org/protocol/ibb</value></field></x></feature></si></iq>
05-15 13:42:04.040: I/System.out(523): 01:42:04 PM SENT (1093423288): <iq id="DK1IO-10" to="friendsUsername@beta.myCompany.co.uk/Spark 2.6.3" type="get"><query xmlns="http://jabber.org/protocol/disco#info"></query></iq>
05-15 13:42:04.060: I/System.out(523): 01:42:04 PM RCV (1093423288): <iq id="DK1IO-10" to="myUsername@beta.myCompany.co.uk/123" type="result" from="friendsUsername@beta.myCompany.co.uk/Spark 2.6.3"><query xmlns="http://jabber.org/protocol/disco#info"><identity category="client" name="Smack" type="pc"/><feature var="http://jabber.org/protocol/xhtml-im"/><feature …Run Code Online (Sandbox Code Playgroud) 我正在使用XMPP(Jabber)协议中的openfire/jsjac开发即时消息模块(J2EE Web应用程序的一部分).
openfire用户/组管理/表已被重定向到我们的业务数据库表,这意味着我不再需要在openfire中维护用户/组.已在业务数据库中设置所有用户/组关系.
下面是我根据要求绘制的关于主窗格的图片.由于我的声望很低,我无法发布图片,所以我发布了一个url作为我的即时消息主UI的图像.很抱歉给您带来不便. instantmessage主UI图像
你们可以看到在左侧窗格中,没有用户/组列表.根据历史记录保存了会话,这让我很困惑,特别是关于组.我从XMPP.org上读到了"XEP-0045:多用户聊天".我知道有关群聊的一般工作流程: XEP-0045:多用户聊天"
并且知道有房间类型是持久性房间被解释为" 如果最后一个占用者退出的话没被破坏的房间;反义词:临时房间. "由doc.在同一个文档中有一些句子说:
房间所有者必须能够摧毁房间,特别是如果房间是持久的.工作流程如下:
看完上面这句话后,我更加疑惑,有几个问题我还是很困惑.
除了上面的问题,我还想到了实现具有持久性空间的MUC的工作流程.请你检查一下,看看流程中存在哪些问题?
我的工作流程为MUC提供持久的空间
所以无论角色是什么,所有者或普通会员,如何根据房间jid或房间id重新加入和重新加入创建的房间,前提是房间类型是"持久的"?
我知道之前已经多次询问过这个问题,但是所提议的解决方案都没有解决我的问题(或者我没有正确地实现它们).
我正在为OpenFire开发一个插件,当我在我的插件源中设置一个断点时,Eclipse会报告"Source not found".JAR与OpenFire服务器的构建分开构建.我已经尝试添加JAR并指定源代码目录,但没有骰子.
这是我正在遵循的过程:当我点击我的断点时,我点击"编辑源查找路径",单击"添加",Java库,用户库,单击用户库,添加我的库(尝试"添加JAR"和"添加外部JAR"),然后指定包含源代码的文件夹.我也尝试过:
在此先感谢您的任何建议.
我已经使用XMPP iOS Framework和OpenFire服务器实现了聊天应用程序.
幸运的是,应用程序运行成功但我在应用程序中面临一个互联网断开问题.
当用户注销或手动进入离线模式时,它会向他/她的名单发送节.所以他/她的名单知道用户进入离线模式.
现在,当互联网将断开与用户设备的连接时,由于互联网断开连接,应用程序无法向服务器发送在线状态节.因此,他/她的名单将无法获得有关该离线用户的信息,用户将仅以在线模式显示.
我认为像OpenFire服务器这样的东西可能能够检查连接的用户,并且当任何用户断开连接时,它应该向他的名单发送具有离线状态的在线状态,以便他们知道该用户处于离线模式.
如果我能通过任何方式实现此功能,请有人帮助我.
解决这个问题对我很有帮助.
提前致谢.
我使用Openfire(xmpp)服务器构建了一个聊天应用程序.一对一的人聊天工作正常,消息即时传递.但是当我们在组内发送消息时,第一条消息会被延迟,第二条消息会立即传递.
MultiUserChatManager groupChat =
MultiUserChatManager.getInstanceFor(connection).getMultiUserChat("group_name");
groupChat.send("Message object");
Run Code Online (Sandbox Code Playgroud)
为什么第一条消息会被延迟?
MUC创作是
MultiUserChatManager mchatManager = MultiUserChatManager.getInstanceFor(xmpptcpConnection);
MultiUserChat mchat = mchatManager.getMultiUserChat(group);
if (!mchat.isJoined()) {
Log.d("CONNECT", "Joining room !! " + group + " and username " + username);
boolean createNow = false;
try {
mchat.createOrJoin(username);
createNow = true;
} catch (Exception e) {
Log.d("CONNECT", "Error while creating the room " + group + e.getMessage());
}
if (createNow) {
Form form = mchat.getConfigurationForm();
Form submitForm = form.createAnswerForm();
List<FormField> formFieldList = submitForm.getFields();
for (FormField formField : …Run Code Online (Sandbox Code Playgroud) 我在openfire中通过安装open fire插件从openfire获取了History并尝试了这段代码.
let iq1 = DDXMLElement(name: "iq")
iq1.addAttribute(withName: "type", stringValue: "get")
iq1.addAttribute(withName: "id", stringValue: "0")
let retrieve = DDXMLElement(name: "retrieve", xmlns: "urn:xmpp:archive")
retrieve?.addAttribute(withName: "with", stringValue: "raman@ip-172-31-53-77.ec2.internal")
let set = DDXMLElement(name: "set", xmlns: "http://jabber.org/protocol/rsm")
let max = DDXMLElement(name: "max", stringValue: "50")
iq1.addChild(retrieve!)
retrieve?.addChild(set!)
set?.addChild(max)
stream?.send(iq1 )
Run Code Online (Sandbox Code Playgroud)
现在我没有从双方获得历史.这是我得到的结果.
<iq xmlns="jabber:client"
type="result"
id="0"
to="bentick@ip-172-31-53-77.ec2.internal/5qsinh1syg">
<chat xmlns="urn:xmpp:archive"
with="raman@ip-172-31-53-77.ec2.internal"
start="2017-02-07T06:28:33.691Z">
<from secs="0">
<body>hello</body>
</from>
<from secs="405">
<body>hiii</body>
</from>
<from secs="580">
<body>Hey</body>
</from>
<from secs="599">
<body>HooooE</body>
</from>
<from secs="628">
<body>hOo</body>
</from>
<from secs="907">
<body>Raman here</body>
</from> …Run Code Online (Sandbox Code Playgroud)我正在开发基于asmack lib的Android上的聊天应用程序.我在ListView上显示所有用户,但我使用图像显示在线/离线用户.但它只返回离线图像,即使用户在线,这里是我的代码
@Override
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
// setContentView(R.layout.buddies);
Controller.getInstance().roster = Controller.getInstance().connection.getRoster();
// ArrayList<Buddy> buddies = new ArrayList<Buddy>();
Collection<RosterEntry> entries = Controller.getInstance().roster.getEntries();
Controller.getInstance().buddyList = new Buddy[entries.size()];
int i = 0;
for (RosterEntry r : entries) {
Buddy bud = new Buddy();
VCard card = new VCard();
try {
ProviderManager.getInstance().addIQProvider("vCard",
"vcard-temp", new VCardProvider());
card.load(Controller.getInstance().connection, r.getUser());
} catch (XMPPException e) {
Log.e("ChatOnAndroid", e.getMessage() + " " + r.getUser() + " "
+ e.getLocalizedMessage());
}
bud.jid …Run Code Online (Sandbox Code Playgroud) 我已经在本地计算机上设置了我的开火(jabber服务器),其中包含两个用户testuser1和testuser2.使用Spark客户端,两个用户都可以毫无问题地进行聊天,这很不错.
openfire IP -192.168.1.65
我想使用smack API(3.3.0)发送和接收消息.我已经写了发送方端代码来发送消息(使用testuser1)并在testuser2端接收到Spark客户端(带有testuser2)消息进行测试,但是当我尝试使用java代码接收发送方消息时,我无法接收这些发布消息.
Sender.java
import org.jivesoftware.smack.Chat;
import org.jivesoftware.smack.XMPPConnection;
import org.jivesoftware.smack.XMPPException;
import org.jivesoftware.smack.packet.Message;
import org.jivesoftware.smack.MessageListener;
public class Sender
{
public static void main(String a[]) throws XMPPException, InterruptedException
{
XMPPConnection connection = new XMPPConnection("192.168.1.65");
System.out.println(connection);
connection.connect();
connection.login("testuser1", "test123");
Chat chat = connection.getChatManager().createChat("testuser2@sameek", new MessageListener() {
public void processMessage(Chat chat, Message message) {
// Print out any messages we get back to standard out.
System.out.println("Received message: " + message);
}
});
chat.sendMessage("Howdy test1!");
while (true) {
Thread.sleep(50);
}
}
} …Run Code Online (Sandbox Code Playgroud) 我在过去四天尝试使用自己的XMPP和Smack + OpenFire发送和接收聊天消息.根据Smack的"readme.txt"我设置连接并登录用户.连接和登录的代码是这个
public static String TAG = "Test connection";
private static XMPPTCPConnection connection;
private static String userName = "demo";
private static String Password = "demo";
static {
// Create the configuration for this new connection
XMPPTCPConnectionConfiguration.Builder configBuilder = XMPPTCPConnectionConfiguration.builder();
configBuilder.setSecurityMode(XMPPTCPConnectionConfiguration.SecurityMode.disabled);
configBuilder.setResource("");
configBuilder.setUsernameAndPassword(userName, Password);
configBuilder.setServiceName("192.168.2.10");
configBuilder.setHost("192.168.2.10");
configBuilder.setPort(5222);
configBuilder.setCompressionEnabled(false);
connection = new XMPPTCPConnection(configBuilder.build());
}
Run Code Online (Sandbox Code Playgroud)
这样我配置了connectionbuilder.在这里,我正在连接并签署用户.
public class ConnectAndLogin extends AsyncTask<Void, Void, Void> {
@Override
protected Void doInBackground(Void... params) {
try {
connection.connect();
Log.i(TAG, "Connected to " + connection.getHost());
} catch (SmackException …Run Code Online (Sandbox Code Playgroud)