Add unreliable (UDP) event support#493
Open
cocorico8 wants to merge 1 commit into
Open
Conversation
Add MP.TriggerClientEventUnreliable and MP.TriggerClientEventJsonUnreliable
Lua bindings, mirror of the reliable versions using UDP transport ('e' packets
instead of 'E'). InternalTriggerClientEvent now takes a Rel flag to select
between TCP and UDP delivery.
'E' and 'e' packets both route through the same HandleEvent handler.
Client events reach Lua handlers identically regardless of transport
reliability.
Use case: high-frequency loss-tolerant data where TCP retransmission of
stale data is actively harmful.
This was referenced Jun 14, 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-Launcher#253, BeamMP/BeamMP#892