xmpp server demo scenario
TRANSCRIPT
The Binaries
You can download the latest binary from intranet
There are 2 component of the demo for this application :
1. Xmpp Server
2. Xmpp Client
You can find the server executable (Petrolink.XmppServer.StartPanel ) in folder server.
You can find the client executable (Petrolink.XmppServer.ClientEmulator) in Client Directory
XMPP Server Control Panel
To initialize an xmpp server we have to define domain name, client port and server port.
Domain name or domainpart is used to identified the server, so every client that connect to this server
will have the identifier/JID like the following format local@domain/resource. The complete guide to the
address explanation is available from RFC 122
Client ports is the port that used by client to connect to the server. The default value for this port is
5222. For this demo because there are multiple server will be running in the same computer, so we have
to make the port configurable.
Server port is the port that used by another Xmpp server to connect to the server
You can start the server by press start button.
When the XMPP Server is started the server bind the client port and server port and waiting for
incoming connection. The listener is simply listen to incoming TCP connection to each port. We can see
the event from the logger.
The internal working of the server is something like this. ClientConnectionHandler will be resposible for
receiving incoming connection from client on port 5222 and ServerConnectionHandler will be
responsible for receiving connection from server on port 5333.
xmpp server ClientConnectionHandler
ServerConnectionHandler
For receiving socket connection the server using Asynchronous Programming Model (APM), so there's
no blocking for receiving each connection.
XMPP Client Panel
After we started the server then we can start the client to connect to the xmpp server.
Some parameter has to be configure for the client. User and domain is required to build the JID for this
server. Resource is already provided for this demo. Username is identifier for the client to authenticate
to the server, domain is use to join to the correct server and the default port for client to connect is
5222.
After filling all the parameter then we can start the client. Press Login button to connect to the server.
You can see some log regarding the login and handshake process from the logger. The logger is available
in the server side too.
You can find the explanation about the handshake process from the specification.
http://xmpp.org/rfcs/rfc6120.html#examples-c2s
After the client authenticate to the server then the client is identified by jid (
tambunanw@jakwt/PetroLink). The resource has been hardcoded for the demo purpose. This can be
created from the client or generated by the server.
The connection between server and client is now secured because right now it used TLS as the
specification define.
http://xmpp.org/rfcs/rfc6120.html#tls
Sending Message between client in the same server
We will demo the scenario based on this schema.
jakwt
farnanm@jakwt/PetroLink tambunanw@jakwt/Petrolin
k
Start another client with the following parameter and press login button
Now we can send the message from tambunanw to farnanm. In order to do that, we have to specify the
destination. Fill that blank with farnanm@jakwt/PetroLink and klik Send Message button. You should
see the logger will log the message stanza.
The message is received by server, the server get the session of the destination message and pass the
message to the receiver. Maybe the event order in the server log is unordered, that because the event is
asynchronous and push to the user interface by using asynchronous dispatcher too.
You can check that the client (farnanm@jakwt/PetroLink) receive the message by verifying in its log.
User can send Iq too to another user with full jid. Press the Send Iq button to send Iq.
The difference from Message stanza and Iq is you can send the message to the bare Jid
(farnanm@jakwt) but you have to use full JId to send an Iq. From the picture below you can see the
client send the message to the server with the bare jid (farnanm@jakwt). tambunanw try to send the Iq
to the bare jid but it won't receive by the client, because it has to use the full jid for destination.
Take a look the logger for the farnanm . There's no Iq received from the server. Only the message.
What's need to be completed from this demo is that the server should return the Iq Error if the server
can't route the Iq to the destination server.
Server to Server
We will run the following scheme for this scenario
Start another server with the following configuration. Make sure that you change the domain and
especially the port if you run the program within the same computer. In this case we fill
domain : datacenter
Client Port : 5224
Server Port : 5225
jakwt datacenter
tambunanw@jakwt aristo@datacenter
Now we want to connect the jakwt server to the datacenter server. Fill this configuration
Destination Domain : datacenter (fill this with the server destination we want to connect with)
Port : 5225 (fill this with the datacenter server port). After fill all the configuration press Connect To. The
server will be connected to the datacenter server using server to server mechanism based on the
RFC6120-ServerToServer.
After you fill all the configuration you can press Connect To button
Because there's only one server connected to this server so the datacenter should be the default
gateway.
The same thing happen with the datacenter server here.
Client to Client between different Server
Now we want to start a client that can connect to datacenter. Fill the configuration with the following.
user : aristo
domain : datacenter
port : 5224 (datacenter client port)
Press Login button.
We can send message from tambunanw at jakwt to aristo at datacenter. We've just need to change the
destination of the message in the tambunanw.
you can send the message back to tambunanw from aristo
Three Server Chain
Start the third server with the following configuration
domain : office
client port : 5226
server port : 5227
Connect the data center server to office server. You can do this by using the same method as previous.
Fill this configuration in data center control panel.
destination domain : office
port : 5227
After you fill all the configuration you can press Connect To button
jakwt datacenter office
tambunanw@jakwt
t
basir@office
You can check the log in both logger to make sure that both server is connected.
As usual the default gateway is always the first conected server for this demo.
Now we need to create a client for this office server. Start the client with the following configuration.
Press login button
We can send the message from basir@office to aristo@datacenter
From the office we can send the message to the jakwt via intermediary server (datacenter). In this case
basir@office can send the message to tambunanw@jakwt.
Four Server Chain
Start the fourth server with the following configuration
domain : aberdeen
client port : 5228
server port : 5229
And click start button.
Now we connect the office with aberdeen. Fill the following configuration on office control panel. And
press ConnectTo button
jakwt datacenter office
tambunanw@jakwt
t
anas@aberdeen
aberdeen
Abeerden will receive the office as its default gateway
Now Start a client with following configuration to connect to aberdeen
user : anas
domain : aberdeen
port : 5228
anas@aberdeen can send the message to basir@office, aristo@datacenter and tambunanw@jakwt
anas@aberdeen to tambunanw@jakwt
Branch Server with Additional Routing
For this scenario we will need to add 2 more server to the previous configuration.
We need to configure branch with the following configuration
domain : branch
client port : 5230
server port : 5231
Press start button to start branch server
jakwt datacenter
office
tambunanw@jakwt
t
anas@aberdeen
aberdeen
branch mexico
trino@mexico
we now connect the datacenter to branch by configure the datacenter panel.
fill the configuration with the following parameter :
destination domain : branch
port : 5231
after that press connecto button and the branch will be added to connected server.
you can verify the datacenter will be added to branch too.
Now we need to start mexico server and connect that to branch.
start mexico server with this configuration
domain : mexico
client port : 5232
server port : 5233
Connect the branch to mexico server by configuring this parameter in branch panel
Destination Domain : mexico
Port : 5233
The server will be added to the mexico server too.
Now because the client in jakwt can't contact the client in mexico or aberdeen directly, so we have to
add a route in datacenter.
There are two route need to be add, we have to tell that if the datacenter want to contact mexico then
it has to go through branch and if the data center want to contact aberdeen then it has to go through
office.
Now let's add the mexico through branch in datacenter routing.
fill connect route with "mexico branch" and press add route button
after that fill connect route with "aberdeen office" and press route button
Now let's add a client that connect to mexico server.
user : trino
domain : mexico
port : 5232
Press login button
Now let's try to send the message to tambunanw@jakwt and vice versa
But it can send the message from trino@mexico to anas@aberdeen.