private void OnSessionRequest(P2PSessionRequest_t request) { CSteamID clientId = request.m_steamIDRemote; if (steamIdToConnection.ContainsKey(clientId)) { SteamNetworking.AcceptP2PSessionWithUser(clientId); } else { if (steamIdToConnection.Count < maxConnections - 1) { if (ShouldAcceptSteamId(clientId)) { if (SteamNetworking.AcceptP2PSessionWithUser(clientId)) { if (SteamNetworking.SendP2PPacket(clientId, null, 0, EP2PSend.k_EP2PSendReliable)) { var conn = new SteamNetConnection(clientId); ForceInitConnection(conn); steamIdToConnection.Add(clientId, conn); NetworkServer.AddExternalConnection(conn); } } } else { Debug.Log("Steam session request ignored"); } } } }
public void CreateP2PConnectionWithPeer(CSteamID peer) { Debug.Log("Sending P2P acceptance message and creating remote client reference for UNET server"); SteamNetworking.SendP2PPacket(peer, null, 0, EP2PSend.k_EP2PSendReliable); // create new connnection for this client and connect them to server var newConn = new SteamNetworkConnection(peer); newConn.ForceInitialize(); NetworkServer.AddExternalConnection(newConn); AddConnection(newConn); }
public override void OnConnected(NetworkConnection conn) { base.OnConnected(conn); NetworkServer.AddExternalConnection(conn); }
/// <summary> /// Handler for the Connect message of WebGL clients. /// </summary> /// <param name="netMsg">The network message that was received.</param> protected virtual void OnWebGLConnected(NetworkMessage netMsg) { NetworkServer.AddExternalConnection(netMsg.conn); }
void OnWebGLConnected(NetworkMessage netMsg) { Debug.Log("Connected"); NetworkServer.AddExternalConnection(netMsg.conn); }