Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[Enhancement]: Protocols need to send additional packets after the RMC response #85

Open
1 task done
ashquarky opened this issue Jan 10, 2025 · 0 comments
Open
1 task done
Labels
awaiting-approval Topic has not been approved or denied enhancement An update to an existing part of the codebase

Comments

@ashquarky
Copy link
Member

Checked Existing

  • I have checked the repository for duplicate issues.

What enhancement would you like to see?

Various protocols generate additional traffic outside the basic RMC request-response model, but nex-protocols-go does not provide enough control over ordering to implement this fully.

For example, take matchmaking and its participation notifications:
Screenshot_20250110_144322
(Capture from Minecraft: Wii U Edition on Nintendo Network)

Note how the RMC Success response is delivered first, then the notification events relevant to the joined match. The PRUDP sequence numbers also reflect this ordering.

Under the current design of nex-protocols-go, this isn't possible to emulate, since the protocol implementation only gets to return a single RMC response, and globals.Respond will only ever emit a single PRUDP packet.

rmcMessage, rmcError := protocol.JoinMatchmakeSessionWithParam(nil, packet, callID, joinMatchmakeSessionParam)
if rmcError != nil {
globals.RespondError(packet, ProtocolID, rmcError)
return
}
globals.Respond(packet, rmcMessage)

Currently this is worked around by emitting the notifications inside the protocol implementation itself, but this results in the wrong ordering.

Any other details to share? (OPTIONAL)

Some ideas for improving this:

  1. Add an events system, like the existing emit("data") stuff in nex-go, to either PacketInterface or a new "call context" struct containing PacketInterface, then add an OnAfterResponse event. The protocol implementation could then register a lambda function to finish up any additional work it wants to do after the RMC response is sent (like notification delivery). This feels like a neat solution since all notification delivery can be handled together after matchmaking is "done".
  2. Allow multiple packets to be returned from the protocol implementation, which are then all sent by nex-protocols-go. This is a slightly messier solution for notifications in particular since, in addition to the notifications to the caller described here, there's also notifications going to other unrelated clients too which would need separate handling. Would allow for bundling with the RMC response, though.
@ashquarky ashquarky added enhancement An update to an existing part of the codebase awaiting-approval Topic has not been approved or denied labels Jan 10, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
awaiting-approval Topic has not been approved or denied enhancement An update to an existing part of the codebase
Projects
None yet
Development

No branches or pull requests

1 participant