Add unreliable (UDP) event support#253
Open
cocorico8 wants to merge 2 commits into
Open
Conversation
Fix Zp packet detection to use exact prefix match (compare(0,2) instead of find()) to avoid false positives mid-payload. Exclude 'e' packets from the >1024-byte-compressed TCP upgrade threshold so unreliable events stay on UDP regardless of payload size.
This was referenced Jun 14, 2026
WiserTixx
requested changes
Jun 15, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Adds an unreliable counterpart to the existing reliable event system, allowing mods to send events over UDP instead of TCP.
New API
Server-side Lua:
MP.TriggerClientEventUnreliable(PlayerID, EventName, Data)— UDP deliveryMP.TriggerClientEventJsonUnreliable(PlayerID, EventName, Data)— JSON variantClient-side Lua:
TriggerServerEventUnreliable(EventName, Data)— sendse:EventName:Datato serverHow it works
Reliable events use
E(uppercase) as the packet prefix, unreliable usee(lowercase). Both follow the same code path — the only difference is TCP vs UDP transport.The launcher skips the >1KB compressed-size TCP upgrade for
epackets so they stay on UDP regardless of payload size.Why
The existing event system only supports reliable delivery. This forces TCP retransmission for every event, which is unnecessary overhead for data that doesn't need guaranteed delivery. This adds the option to opt into UDP where appropriate.
See also: BeamMP/BeamMP-Server#493, BeamMP/BeamMP#892