Class ChatBroadcastSerializer
Hand written wire format for ChatBroadcast.
public static class ChatBroadcastSerializer
- Inheritance
-
ChatBroadcastSerializer
- Inherited Members
Remarks
Exists for one reason: to keep ReceivedUtcTicks off the wire.
The field is server-internal. ChatSystem.OnServerChatBroadcastReceived stamps it at
the network boundary and it is read only by the spam token bucket and the audit
persistence, all server side — no client has ever read it. But the server re-broadcasts the
same struct it received, so the generated serializer put a full DateTime.UtcNow.Ticks
on every outbound message: roughly 6.4e17, which zigzags to 61 significant bits and costs
NINE varint bytes. On a short line of say chat that was about half the packet, paid to every
observer of the sender, on the most fanned-out message in the game.
Not written and not read, rather than zeroed at each fanout site: there are more than twenty send sites and a new one would silently reintroduce the cost. Leaving it out of the format makes the field's own documentation true in both directions — a client cannot assert a receive time it did not observe, and the server always stamps its own.
Discovered by FishNet's codegen through the Write*/Read* naming convention.
Methods
ReadChatBroadcast(Reader)
Reads a ChatBroadcast. ReceivedUtcTicks comes back zero.
public static ChatBroadcast ReadChatBroadcast(this Reader reader)
Parameters
readerReader
Returns
WriteChatBroadcast(Writer, ChatBroadcast)
Writes a ChatBroadcast, omitting the server-only timestamp.
public static void WriteChatBroadcast(this Writer writer, ChatBroadcast value)
Parameters
writerWritervalueChatBroadcast