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 XMPP-based IOS chat client.ProgramFirst, we need the XMPP server. Here, I will use the local machine as the server. First, download it from the XMPP server.EjabberdThis 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:
What we need to explain here is <Access Control List> Here we set the Administrator. We can create other administrators here. This is not our focus, but our focus is <Virtual Host>
Click <Virtual Host>, There is a <Dpc1338a>, Also click
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.
after the server is installed, we need to download a client to chat. Here are some client tools