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
Breaking: Headless servers reject clients #859
Comments
Issue IdentifiedIf I build the headless server and leave off the The logs show a client<>server handshake and persists without disconnection. The server logs show confirmation of this: [Netcode] StartServer
[Netcode] A ConnectionApproval callback is defined but ConnectionApproval is disabled. In order to use ConnectionApproval it has to be explicitly enabled
[Netcode] Initialize
[Netcode] Client Connected
No client player ID found mapped to the given client ID: 1
[Netcode] [Server-Side Client-Synchronization] NetworkObject serialization order:UIMessageManagerSceneLoaderPersistentPlayer1Continued IssuesSo we have a client<>server handshake, but UI does not respond as expected. To fix:
I have a feeling that the UI desync has to do with the log Approval was enabled by default and the only way a headless server seems to be able to get this working is to disable this. Missing DocumentationAs a true use of a client/server will often be likely to have a headless (dedicated) server rather than connecting as a "Host" via the UI,
Any possibility we can get some of this rolling? FishNet, Mirror and Photon all have the ability to auto-start a headless server (with documentation and -arg handlers), if that means anything. |
|
Hi Dylan! Boss Room is a sample showcasing the client-hosted model. It is not meant to provide education on the dedicated-server approach. In this case it is hard to say without looking directly at your code, but it seems the issue is with Connection Approval. Boss Room has a specific flow for connecting, which includes some setup on the host, and on the clients, with each client sending some specific data for approval, and the server giving them a reply with some more data. Bypassing the intended flow (done via UI) without making sure that the flow stays the same will prevent connection. However, while Netcode for GameObjects does support dedicated servers (headless or not), porting a game sample intended for the client-hosting model to the dedicated server model will require significant changes. You can have a look at this documentation for more information about this process and for general information about the Dedicated Server model. Also, if you are using Unity 2023.1 or higher, there is the experimental Dedicated Server Package that provides many useful tools for this type of games. (This package is still experimental and in active development and is meant to be used with the purpose of workflow testing and providing feedback.) We are also working on more educational content for the dedicated server flow with Netcode for GameObjects, but it is still in early development. |
|
Closing this issue as it has been a few weeks. If you require additional support feel free to reach out to us, or to the NGO team in their repo or via our discord server. |

Describe the bug
When running a local headless Linux || Windows server (UDP), clients are auto-rejected.
To Reproduce
Steps to reproduce the behavior:
Server
Leaving default scene build order:
!ConnectionApprovaldeveloper127.0.0.1:7777#if UNITY_SERVER(or a cli-arghandler) to triggerNetworkManager.Singleton.StartServer();-batchmode -nographics127.0.0.1:7777.Client
(A)
127.0.0.1:7777(should match server^)Failed to connect to server(B)
Failed to connect to serverExpected behavior
Client should connect to headless server running
NetworkManager.Singleton.StartServer()on initScreenshots

Environment (please complete the following information):
Additional context
Connection does work if solely using UI, leading me to believe the issue has something to do with NetworkManager handling with
Startup. I'll continue to look into this. Perhaps if server start with MainMenu instead of Startup, it may work.The text was updated successfully, but these errors were encountered: