Console
Friends

Chat Poll

Returns new messages received from any friend since a given timestamp. Call every 5 seconds for near-real-time chat. Always use the server_time from the response as your next since value.

POST /api/vaneltonid/chat_poll.php
Requires Authorization: AppID:AppKey + user token

Request body

FieldTypeRequiredDescription
tokenstringrequiredUser's session token
sincestringrequiredDatetime in Y-m-d H:i:s format. Returns messages received after this timestamp.

Success response 200

{
  "success": true,
  "count": 1,
  "server_time": "2026-05-29 14:36:00",
  "messages": [
    {
      "id": 502,
      "user_id_1": 10,
      "user_id_2": 42,
      "sender_id": 10,
      "sender_username": "friend1",
      "sender_profileimg": "https://...",
      "message": "Want to play now?",
      "created_at": "2026-05-29 14:35:30"
    }
  ]
}

Always update your stored since value to the server_time returned in each response — this avoids timezone drift between client and server.

Recommended polling loop

// On chat open: load history and store since
const hist = await chatHistory(friendId);
let since = hist.server_time;

// Poll every 5s
setInterval(async () => {
  const { messages, server_time } = await chatPoll(since);
  since = server_time;             // always advance
  messages.forEach(m => appendMessage(m));
}, 5000);