Facepunch.Steamworks Wiki

Steamworks.SocketManager.OnConnectionChanged

Syntax

Arguments

How to use it?

Is called whenever a client connect/disconnect or something happen to server. You can handle your connection logic here using "connection" and "info" . In order to permit to a client to connect you need to handle at least 2 state : "info.State == ConnectionState.Connecting" -> here you check if the client is allowed to connect and then use either "connection.Accept()" or "connection.Close()" you can get a result from it with this code :

Result res; if((res = connection.Accept()) == Result.OK) { // Client is accepted and will connect } else { // Something went wrong whith the connection (check the Result value) }

Second state to handle : "info.State == ConnectionState.Connected" -> here you can register the client to your networking logic so he can receive data from server:

if (info.State == ConnectionState.Connected) { // A client is successfully Connected // Do wathever you need to do when a client connect }