Conversation
Contributor
There was a problem hiding this comment.
Pull request overview
Adds protocol version propagation and compatibility enforcement so Unity clients can detect incompatible server versions during the initial ID-mapping handshake and disconnect cleanly.
Changes:
- Server now embeds its semantic version (major/minor/patch) into
MSG_DEVICE_ID_MAPPING. - Server adds
parse_version()and updates ID-mapping serialization to include the version bytes. - Unity adds a public
OnVersionMismatch(serverVersion, clientVersion)event and disconnects on mismatch.
Reviewed changes
Copilot reviewed 7 out of 7 changed files in this pull request and generated 4 comments.
| File | Description |
|---|---|
| STYLY-NetSync-Unity/Packages/com.styly.styly-netsync/Runtime/NetSyncManager.cs | Exposes OnVersionMismatch UnityEvent and disconnects when MessageProcessor reports incompatibility. |
| STYLY-NetSync-Server/src/styly_netsync/server.py | Includes the server version in device-id mapping broadcasts. |
| STYLY-NetSync-Server/src/styly_netsync/binary_serializer.py | Adds parse_version() and extends MSG_DEVICE_ID_MAPPING serialization to carry version bytes. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
STYLY-NetSync-Unity/Packages/com.styly.styly-netsync/Runtime/NetSyncManager.cs
Show resolved
Hide resolved
STYLY-NetSync-Unity/Packages/com.styly.styly-netsync/Runtime/NetSyncManager.cs
Show resolved
Hide resolved
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.
Version Check Feature
Overview
The version check ensures that the server and Unity client are running compatible protocol versions. It is performed once when a client first
connects to a room.
Protocol
The server includes its version (3 bytes: major, minor, patch) in the MSG_DEVICE_ID_MAPPING message:
[1 byte] Message Type (6)
[1 byte] Major Version ← Added
[1 byte] Minor Version ← Added
[1 byte] Patch Version ← Added
[2 bytes] Mapping Count
...
Behavior on Mismatch
Public API
// NetSyncManager.cs
public UnityEvent<string, string> OnVersionMismatch;
// Parameters: (serverVersion, clientVersion) e.g., ("0.7.5", "0.8.0")
Limitations
If the protocol format itself changed incompatibly, the client's initial MSG_CLIENT_TRANSFORM may fail to parse on the server, preventing registration and ID mapping broadcast. In this case, the client will timeout rather than receive an explicit version mismatch error.
Close #50