XML Packets

From Club Penguin Protocol
Jump to: navigation, search

XML Packets

Packet Action Description
Version Check verChk Checks the client's SmartFoxClient library version
API Response apiOK / apiKO Response to the client's version request
Random Key rndK Request a random key from the server (i.e. for shared hashing)
Login Request login Logs into a zone with the passed credentials.
(Funny ones after login that CP didn't disable)
Room List getRmList / roomList Gets a list of rooms in the zone, including IDs, user lists, etc.
Join Room joinRoom / joinOK Join a specific room by Internal ID (not sure if enabled)

How XML Packets Work

As Club Penguin is written atop of SmartFoxServer, before login, the packets used are standard SmartFoxServer (i.e. XML, and not as efficient).

Let's have a look at an example:

* <msg t='sys'><body action='verChk' r='0'><ver v='140' /></body></msg> (in packet examples, the GT symbol (>) is used to denote a packet sent by the client, and LT (<) to denote one received.

We can split an XML packet into several chunks based on the level of nesting. The first part of the packet (the <msg /> node) is used to express that the packet is for SmartFoxServer

The <msg /> node is always the same. It always has a t attribute with the value of sys.

Now, we get on to the interesting part. The <body /> tag contains several parameters. The "action" attribute is used to determine, well, what the packet does. The "r" attribute contains the Internal Room ID.

Inside, we have the actual parameters. Let's have a look at the ones Club Penguin uses, and ones that Club Penguin (should) have compatibility with. For instance, in the above example, the <ver /> tag tells us the client's API version.