Skip to content
This repository has been archived by the owner on Mar 10, 2019. It is now read-only.
Gianlu edited this page Dec 31, 2017 · 3 revisions

All the communication with the server is made using POST requests. The server has two main endpoints:

  • AjaxServlet
  • LongPollServlet

The request parameters must be encoded in the body accordingly to application/x-www-form-urlencoded. The response is a JSON object. A response may be sent with any status code so better check that.

It's important to preserve cookies between requests as a PYX-Session cookie is set during the register operation to maintain the session.

AjaxServlet

Every request to AjaxServlet must contain an operation code, specified with "o". Here are all the currently available codes:

  • BAN -> b
  • CARDCAST_ADD_CARDSET -> cac
  • CARDCAST_LIST_CARDSETS -> clc
  • CARDCAST_REMOVE_CARDSET -> crc
  • CHANGE_GAME_OPTIONS -> cgo
  • CHAT -> c
  • CREATE_GAME -> cg
  • FIRST_LOAD -> fl
  • GAME_CHAT -> GC
  • GAME_LIST -> ggl
  • GET_CARDS -> gc
  • GET_GAME_INFO -> ggi
  • JOIN_GAME -> jg
  • SPECTATE_GAME -> vg
  • JUDGE_SELECT -> js
  • KICK -> K
  • LEAVE_GAME -> lg
  • LOG_OUT -> lo
  • NAMES -> gn
  • PLAY_CARD -> pc
  • REGISTER -> r
  • SCORE -> SC
  • START_GAME -> sg
  • STOP_GAME -> Sg

Example request (register with nickname "test"):

POST /AjaxServlet HTTP/1.1

o=r&n=test

LongPollServlet

This endpoint is used by the server to send events to the client. As soon as the client is registered, it has to start making requests, the server holds the request until some data is available. When the client has finished receiving the data, it must launch another request immediately.

Clone this wiki locally