Master-servers' protocol

Master-server's message formatting: "<message_code, 1 byte><payload>"

Message codes

 -- Client message codes -> to Master
 local INIT = 1 -- initial connection, send username
 local FIND = 2 -- send lobby's / other player's fullname

 -- Master message codes -> to Client
 local FLUSH = 1 -- leave lobby, drop all
 local JOIN = 2  -- found lobby / player, connect to it

Payloads

Message Payload
Client.INIT "<public_ip, string>;<username, string>"
Client.FIND "<username, string>"
Master.JOIN "<p1_ip>;<p2_name>;<p2_public_ip>;<p2_ip>"
Master.FLUSH no payload

p1_ip is used to determine if players is under one NAT and avoid hairpinning problems.

Last updated 2021-05-28 15:24:22