I recently read about the XMPP framework. Taking text chat as an example, the message to be sent is:
[HTML]View
Plaincopy
- <Message type = "chat" from = "kang@server.com" to = "test@server.com">
- <Body> helloword </body>
- </Message>
In the base, from is the message sent from the user, to is the message sent to the user, XMPP users are in the form of mailbox. Body is the message text we send.
Now, let's develop an iOS chat client program based on XMPP. First, we need the XMPP server. Here, I will use this machine as the server, first download the ejabberd server from the XMPP server. ejabberd supports Linux
/Mac OS X/Solaris/windows, so any operating system can be used as our chat server. Okay. After the download is complete, you can install it step by step. here we need to pay attention to it.
Here, our server is dpc1338a (generally the machine name, which can be changed by default). The user names of each machine are different. The server domain name here is the machine name, remember this.
The next step is to set the administrator password. Remember the password. Otherwise, we cannot log on to the Administrator page.
Okay. After the installation is complete, start as follows:
Click admin interface and we will be asked to enter the user name and password:
Here, the user name is an administrator name when we installed it. We can combine the Administrator name with our server. Here I am admin @ dpc1338a, and each machine is different, do not copy it. In this way, you cannot log on. The password is the password set during installation.
After successful logon, the following page is displayed:
Here we need to explain the <Access Control List>. Here we set up the Administrator. We can create other administrators here. This is not our focus, but our focus is <virtual host>
Click <virtual host>, and there is a <dpc1338a> below.
Here is a <user>. We need to create several users for data interaction.
I created Kang @ dpc1338a, test @ dpc1338a, ABC @ dpc1338a, and chat with these users later.
Okay. After the server is installed, We need to download a client to chat. Here are some client tools.
Bytes
Framework.