Signing in
packets12 packets
Connecting and signing in: SmartFox's own handshake (SmartFoxClient and handlers/SysHandler in the client), then Animal Jam's login reply.
Hearing and sending packets
What the game sends is heard on phantom.packets.client, and what the server sends on phantom.packets.server. watch hears a packet after it has gone through; on hears it first and may change or drop it; send sends one to that end. See Packets.
Overview
| Packet | Command | Way | What it is |
|---|---|---|---|
VersionCheck | verChk | game → server | The client says which SmartFox version it speaks. |
ApiOk | apiOK | server → game | The server accepts the SmartFox version the client speaks. |
ApiObsolete | apiKO | server → game | The server refuses the SmartFox version the client speaks. |
ServerSelectRequest | sv | game → server | The client tells an ingress which node it wants. |
RandomKeyRequest | rndK | game → server | The client asks for the key it signs its login with. |
RandomKey | rndK | server → game | The server gives the key the login is signed with. |
Login | login | game → server | The client signs in to a zone with its auth token. |
KeepAlive | ka | game → server | The client says it is still there. |
EmailActivationRequest | ves | game → server | The player asks for the email that activates their email address to be sent. |
EmailActivationResult | ves | server → game | The server says whether the activation email was sent. |
EmailValidated | vea | server → game | The account’s email address was validated. |
LoginResult | login | server → game | The server accepts the login and describes the player. |
VersionCheck
<ver v='165'/>: the client's SmartFox version, 1.6.5, sent first on every connection.
Fields
| Field | Type | |
|---|---|---|
version | string | The v attribute: the SmartFox version without its dots, 165. Empty when missing. |
room | number | The room the message was sent in, as the SmartFox room id; -1 when it names none. |
Example
// Each time the game sends it to the server, after it has gone through.
const stop = phantom.packets.client.watch(packets.VersionCheck, (packet) => {
console.log(packet.version);
});ApiOk
The server accepts the SmartFox version (SysHandler.handleApiOK):
<msg t='sys'><body action='apiOK' r='0'></body></msg>
It carries nothing, and it is the message that says the connection is up: the client counts itself connected here and asks for the random key next. Anything that speaks this protocol rather than driving the Flash client has to wait for it, which is why it is described.
Fields
| Field | Type | |
|---|---|---|
room | number | The room the message was sent in, as the SmartFox room id; -1 when it names none. |
Example
// Each time the server sends it to the game, after it has gone through.
const stop = phantom.packets.server.watch(packets.ApiOk, (packet) => {
console.log('session.api-ok');
});ApiObsolete
The server refuses the SmartFox version (SysHandler.handleApiKO), which is the end of that connection: the client shows "API are obsolete, please upgrade" and gets no further.
Fields
| Field | Type | |
|---|---|---|
room | number | The room the message was sent in, as the SmartFox room id; -1 when it names none. |
Example
// Each time the server sends it to the game, after it has gone through.
const stop = phantom.packets.server.watch(packets.ApiObsolete, (packet) => {
console.log('session.api-obsolete');
});ServerSelectRequest
The node a client reaching the game through an ingress wants (SFClient.onConnection, only when isIngressActive): sent once the socket is up and before the random key, to the a extension with the client's own room, which is -1 then:
%xt%a%sv%-1%<serverIp>%
Nothing answers it: the client reads no sv (one would reach PartyXtCommManager, which has no case for it) and asks for the key straight after.
Phantom's desktop is the ingress for a private server game (its proxy on this computer), and adds what it can do after the node, comma separated, for the node to read (PHANTOM_CAPABILITIES):
%xt%a%sv%-1%<serverIp>%node-address%
The client itself never sends that field, and a node that does not know it reads the first.
Fields
| Field | Type | |
|---|---|---|
serverIp | string | The node wanted, as the client was told to reach it (_serverIp). |
capabilities | string[] | What the desktop carrying the game can do (PHANTOM_CAPABILITIES); none from the client. |
room | number | The room the message was sent in, as the SmartFox room id; -1 when it names none. |
Example
// Each time the game sends it to the server, after it has gone through.
const stop = phantom.packets.client.watch(packets.ServerSelectRequest, (packet) => {
console.log(packet.serverIp, packet.capabilities);
});RandomKeyRequest
Asks for the key the login is signed with.
Fields
| Field | Type | |
|---|---|---|
room | number | The room the message was sent in, as the SmartFox room id; -1 when it names none. |
Example
// Each time the game sends it to the server, after it has gone through.
const stop = phantom.packets.client.watch(packets.RandomKeyRequest, (packet) => {
console.log('session.random-key-request');
});RandomKey
<k>...</k>: the key the client signs its login with (SysHandler.handleRandomKey).
Fields
| Field | Type | |
|---|---|---|
key | string | The key, the text of <k>. Empty when missing. |
room | number | The room the message was sent in, as the SmartFox room id; -1 when it names none. |
Example
// Each time the server sends it to the game, after it has gone through.
const stop = phantom.packets.server.watch(packets.RandomKey, (packet) => {
console.log(packet.key);
});Login
The SmartFox login (SmartFoxClient.login). For the game zone it is signed with the random key, so it can be read but not changed. nick carries the username with the session's details after it, %-separated (GamePlay): username, session id, language, deploy version, platform, its version, the operating system and the device fingerprint. password is the Animal Jam auth token, so a packet log shows it only redacted.
Fields
| Field | Type | |
|---|---|---|
zone | string | The SmartFox zone to sign in to, the z attribute. |
nick | string | The username, followed by the session's details, %-separated (see above). |
password | string | The Animal Jam auth token, the text of <pword>. A packet log redacts it. |
room | number | The room the message was sent in, as the SmartFox room id; -1 when it names none. |
Example
// Each time the game sends it to the server, after it has gone through.
const stop = phantom.packets.client.watch(packets.Login, (packet) => {
console.log(packet.zone, packet.nick, packet.password);
});KeepAlive
The keep alive (KeepAlive.sendKeepAliveMsg):
%xt%o%ka%<room>%
Nothing in it and nothing comes back. The client sends one every KEEP_ALIVE_EVERY_MS while the player is doing anything at all, and the connection is dropped after KEEP_ALIVE_KICK_MS of silence, so anything holding a session open without the Flash client has to send them itself.
Fields
| Field | Type | |
|---|---|---|
room | number | The room the message was sent in, as the SmartFox room id; -1 when it names none. |
Example
// Each time the game sends it to the server, after it has gone through.
const stop = phantom.packets.client.watch(packets.KeepAlive, (packet) => {
console.log('session.keep-alive');
});EmailActivationRequest
Asks Animal Jam to send the email that activates an account's email address (VerificationXtCommManager.requestSendEmailActivation, from the email confirmation popup's resend button, gui/EmailConfirmation.as):
%xt%o%ves%<room>%<email>%
The address is the one the player typed into the popup: a parent's, for a younger player.
Fields
| Field | Type | |
|---|---|---|
email | string | The address to send the activation email to. |
room | number | The room the message was sent in, as the SmartFox room id; -1 when it names none. |
Example
// Each time the game sends it to the server, after it has gone through.
const stop = phantom.packets.client.watch(packets.EmailActivationRequest, (packet) => {
console.log(packet.email);
});EmailActivationResult
Whether the activation email was sent (VerificationXtCommManager.handleSendEmailActivation, which hands the popup's callback param1[2] == "1"):
%xt%ves%<room>%<sent>%
Fields
| Field | Type | |
|---|---|---|
sent | boolean | The email went out: the field is 1. |
room | number | The room the message was sent in, as the SmartFox room id; -1 when it names none. |
Example
// Each time the server sends it to the game, after it has gone through.
const stop = phantom.packets.server.watch(packets.EmailActivationResult, (packet) => {
console.log(packet.sent);
});EmailValidated
The account's email address was validated, from the link in the activation email (VerificationXtCommManager.handleEmailValidated). Nothing is read: the client takes the address it was waiting on (clientInfo.pendingEmail) as the account's own (userEmail), rebuilds its HUD and closes the settings screen.
%xt%vea%<room>%
Fields
| Field | Type | |
|---|---|---|
room | number | The room the message was sent in, as the SmartFox room id; -1 when it names none. |
Example
// Each time the server sends it to the game, after it has gone through.
const stop = phantom.packets.server.watch(packets.EmailValidated, (packet) => {
console.log('session.email-validated');
});LoginResult
Animal Jam's login reply, as JSON (SFClient.onExtensionResponse, for _cmd login):
{"t":"xt","b":{"r":-1,"o":{"_cmd":"login","status":1,"params":{...}}}}
A status of 1 is a successful login, and params describes the player. Otherwise statusId says why it failed (GamePlay.onWorldLogIn: -11 the account is in use, -12 account maintenance, -14 too many connections, -15 banned, -16 server maintenance, -24 an outdated client) and message may explain.
Fields
| Field | Type | |
|---|---|---|
success | boolean | The login worked: status is 1. The client compares with == "1", so the number and the string both count. |
statusId | number | null | Why the login failed (see above), or null when the reply has no statusId. |
message | string | null | Text the server sent to explain a failure, or null when there is none. |
params | LoginParams | The player's details as the server sent them, or empty. See readLoginPlayer. |
room | number | The room the message was sent in, as the SmartFox room id; -1 when it names none. |
Example
// Each time the server sends it to the game, after it has gone through.
const stop = phantom.packets.server.watch(packets.LoginResult, (packet) => {
console.log(packet.success, packet.statusId, packet.message);
});