How does the server work?
The whole action is very simple:
1.A client named, for example, client1 sends a message to the server destined to
a client named client2. The message is in a certain shape, for example
<protocol>
<userMsg sendTo="client2">
<data game="27"></data>
</userMsg>
</protocol>
2.The server resends the message to the client2 in the shape of:
<protocol>
<received action="userMsg" sentFrom="test">
<data game="27"></data>
</received>
</protocol>
3.The server confirms to the sender sending of the message. Client1 then receives
the message
<protocol>
<response action="userMsg" errorCode="0"/>
</protocol>
Common information about work with the server
1. In all requests sent to the server we can use the attribute sid. This attribute
is optional and is returned to the client that used it. The attribute sid is to
identify precisely request-answer. If a client does not use this attribute it is
not returned. The attribute has to be of a unique value within the requests of the
same type to be able to use it to distinguish separate requests. This is very important
when sending quick requests.
2. If we send a message to the client, it is always received in the shape of
<protocol>
<received action="userMsg"> ... </received>
</protocol>
action identifies type of the received message.
3. If the server replies to the client the reply is in the shape of
<protocol>
<response action="userMsg" errorCode="0" ... />
</protocol>
Action identifies type of the request and errorCode is a return code. If errorCode="0"
is returned, it means everything has been done well. In the opposite case an error
occured. The following table shows a list of common errors, that the socket server
returns to the client.
errorCode |
|
Error description |
0 |
|
The required operation has passed without any error |
-1 |
|
Incorrect XML format of the sent dates |
-2 |
|
No attribute has been used in the request |
-3 |
|
The client is not logged in to any domain |
-4 |
|
The client is not logged in to any room |
-1000 |
|
The client is not logged in as an administrator |
Other errors will be defined separately for the appropriate function.
Note: Attributes marked with [ ] are optional, so they don`t have to be used in
the XML protocol.
Protocol for using of the XML server
The XML Socket Multiuser Server uses the following commands
Logging in of a client to the server
Logging in of the client to a room
Sending of a private message to a chosen client
Sending of a message to all clients logged in the room
List of clients logged in the room
List of available rooms
Information about the room that the client is logged in
Addition of a room to the domain
Addition of a game room to the domain
Closure of the room
Obtention of names and values of all variables in the room
Obtention of the value of the variable in the room
Setting of the variable in the room to a certain value
Addition of a variable to the room
Deletion of the variable in the room
Test of response of the server
Information about the XML Socket Multiuser Server
Logging out of the client
Use of the XML Socket Multiuser Server extension
A login of the administrator to the server
Sending of a message from the administrator to other clients
Disconnection of client from the server by the administrator
Detailed information about the XML Socket Multiuser Server
Restart of the XML Socket Multiuser Server