Powerful open source chat software
  • Protocol description
 

Common messages (can be sended by client and server)

Text message (TEXT_MESSAGE)

Message format: XXYYZZZZ.

  • XX (Short) — command ID (1)
  • YY (uint) — message length in bytes (ZZZZ)
  • ZZZZ (utf) — message body

    Example: '1'28'Mama myla ramy'

Client side messages (client can send, server can process)

Login message (LOGIN_MESSAGE)

Message format: XXYYZZZZQQQQ

  • XX (short) — command ID (201)
  • YY (uint) — message length in bytes (2+ZZZZ+QQQQ)
  • WW (uint) — roomId
  • ZZZZ (utf) — Login
  • ZZZZ (utf) — Password

    Example: '201'10'Gomes'gomes'

    Note:

    Wee nedd to send from server some additional parameters from server:

  • 0 — all ok, we can process next messages
  • 1 — bad autorization (bad login/pass)
  • 2..n — for future using

    Available chat rooms request (ROOMS_LIST_REQUEST_MESSAGE)

    Message format: XXYYZZZZ

  • XX (Short) — command ID (202)
  • YY (uint) — message length in bytes (ZZZZ)
  • ZZZZ (utf) — some request string, maybe we need to sent also chat room web url or some other information

    Example: '202'12'flash client'

Server side messages (server can send, client can process)

Error message (ERROR_MESSAGE)

Message format: XXYYWWZZ

  • XX (Short) — command ID (101)
  • YY (uint) — message length in bytes (ZZZZ)
  • WW (uint) — error message code
  • ZZ (uint) — error message string

    Example: '101'20'1'Client logic error'

    Available chat rooms list (ROOMS_LIST_MESSAGE)

    Message format: XXYYWWZZZZQQQQZZZZQQQQ..ZZZZQQQQ

  • XX (short) — command ID (102)
  • YY (uint) — message length in bytes (WW + ZZZZQQQQ +..+ ZZZZQQQQ)
  • WW (uint) — chat rooms count
  • ZZZZ (uint) — chat rood id
  • QQQQ (utf) — chat room name

    Example: '102'96'3'1'Pogoda'2'Ofigenniy catrum'3'Ese kakoy libo catrum'

    Users list message (USERS_LIST_MESSAGE). Client got this message after success login

    Message format: XXYYWWZZZZQQQQZZZZQQQQ..ZZZZQQQQ

  • XX (short) — command ID (103)
  • YY (uint) — message length in bytes (WW + ZZZZQQQQ +..+ ZZZZQQQQ)
  • WW (uint) — users count
  • ZZZZ (uint) — user id
  • QQQQ (utf) — user name

    Example: '103'24'2'1'gomes'2'erka'

 
2006 © embedchat.org