RelayedServerSocket 5.46.0
Extends raklib\server\ServerSocket
RakLib socket used when the NetherNet bridge owns the server's UDP port and shares it with RakNet: the bridge keeps WebRTC datagrams for itself and relays every other datagram (RakNet, Query) to this loopback socket with the real address of the sender, and sends what RakLib writes out of the shared port. RakLib sees real client addresses, so sessions, bans and rate limits work as usual.
Datagram format (both ways): u8 type. DATA (0x00): u8 IP version (4 or 6), IP address (4 or 16 bytes), u16 port, payload. HELLO (0x01, bridge -> RakLib only): token, sent periodically so RakLib learns (again, after a restart of the bridge) which loopback port the bridge sends from. Datagrams from any other port are ignored.
Methods
__construct()
public function __construct(\raklib\utils\InternetAddress $publicAddress, string $token)disableBroadcast()
public function disableBroadcast() : boolenableBroadcast()
public function enableBroadcast() : boolgetBindAddress()
public function getBindAddress() : \raklib\utils\InternetAddressgetRelayPort()
public function getRelayPort() : intLoopback port the bridge must relay RakNet datagrams to.
readPacket()
public function readPacket(?string &$source, ?int &$port) : ?stringwritePacket()
public function writePacket(string $buffer, string $dest, int $port) : int