enforceIsResponse

fun enforceIsResponse(request: ScriptingPacket, response: ScriptingPacket): ScriptingPacket

Ensure that a response packet is a valid response for a request packet.

This function only checks the action type and unique identifier metadata of the packets. It should catch desynchronization arising from E.G. race conditions, or if one side either forgets to send an expected packet or erroneously sends an unexpected packet. But as the data field of each packet is variable, and defined more by convention/convergence than by specification, it will not catch if the data contained in the request or response is malformed or invalid. That task is left up to the sender and receiver of the packet.

Parameters

request

Original packet. Sets action type and identifier.

response

Response packet. Should have matching action type and same identifier as request.

Throws

If response and request mismatched.

Sources

jvm source
Link copied to clipboard