public void OnAuthenticated(NetworkConnectionToServer conn) { // set connection to authenticated conn.isAuthenticated = true; Authenticated?.Invoke(conn); }
private void Respond(NetworkConnection value) { if (OnEventRaised != null) { OnEventRaised.Invoke(value); } }
async UniTaskVoid OnConnected() { // reset network time stats // the handler may want to send messages to the client // thus we should set the connected state before calling the handler connectState = ConnectState.Connected; Connected?.Invoke(Connection); // start processing messages try { await Connection.ProcessMessagesAsync(); } catch (Exception ex) { logger.LogException(ex); } finally { Cleanup(); Disconnected?.Invoke(); } }
internal void OnAuthenticated(INetworkConnection conn) { if (logger.LogEnabled()) { logger.Log("Server authenticate client:" + conn); } Authenticated?.Invoke(conn); }
/// <summary> /// Called on clients when a scene has completed loaded, when the scene load was initiated by the server. /// <para>Scene changes can cause player objects to be destroyed. The default implementation of OnClientSceneChanged in the NetworkManager is to add a player object for the connection if no player object exists.</para> /// </summary> /// <param name="conn">The network connection that the scene change message arrived on.</param> internal void OnClientSceneChanged(INetworkConnection conn) { // always become ready. if (!ready) { Ready(conn); } ClientSceneChanged.Invoke(conn); }
internal void OnAuthenticated(INetworkConnection conn) { if (logger.LogEnabled()) { logger.Log("Server authenticate client:" + conn); } // connection has been authenticated, now we can handle other messages RegisterMessageHandlers(conn); Authenticated?.Invoke(conn); }
internal void OnAuthenticated(NetworkConnectionToClient conn) { if (LogFilter.Debug) { Debug.Log("Server authenticate client:" + conn); } // set connection to authenticated conn.isAuthenticated = true; Authenticated?.Invoke(conn); }
internal void OnAuthenticated(INetworkConnection conn) { if (LogFilter.Debug) { Debug.Log("Server authenticate client:" + conn); } // connection has been authenticated, now we can handle other messages RegisterMessageHandlers(conn); Authenticated?.Invoke(conn); }
void OnDisconnected(NetworkConnectionToClient connection) { if (LogFilter.Debug) { Debug.Log("Server disconnect client:" + connection); } RemoveConnection(connection); DestroyPlayerForConnection(connection); Disconnected.Invoke(connection); if (connection == localConnection) { localConnection = null; } }
//called once a client disconnects from the server void OnDisconnected(INetworkConnection connection) { if (logger.LogEnabled()) { logger.Log("Server disconnect client:" + connection); } RemoveConnection(connection); Disconnected.Invoke(connection); connection.DestroyOwnedObjects(); connection.Identity = null; if (connection == LocalConnection) { LocalConnection = null; } }
async Task ConnectionAcceptedAsync(INetworkConnection conn) { if (logger.LogEnabled()) { logger.Log("Server accepted client:" + conn); } // are more connections allowed? if not, kick // (it's easier to handle this in Mirror, so Transports can have // less code and third party transport might not do that anyway) // (this way we could also send a custom 'tooFull' message later, // Transport can't do that) if (connections.Count >= MaxConnections) { conn.Disconnect(); if (logger.LogEnabled()) { logger.Log("Server full, kicked client:" + conn); } return; } // add connection AddConnection(conn); // let everyone know we just accepted a connection Connected.Invoke(conn); // now process messages until the connection closes try { await conn.ProcessMessagesAsync(); } catch (Exception ex) { logger.LogException(ex); } finally { OnDisconnected(conn); } }
/// <summary> /// Called on clients when a servers tells the client it is no longer ready. /// <para>This is commonly used when switching scenes.</para> /// </summary> /// <param name="conn">Connection to the server.</param> internal void OnClientNotReady(INetworkConnection conn) { client.Connection.IsReady = false; ClientNotReady.Invoke(conn); }
public override void OnServerDisconnect(NetworkConnection connection) { base.OnServerDisconnect(connection); clientDisconnectedFromServer.Invoke(connection); }
public override void OnServerAddPlayer(NetworkConnection connection) { base.OnServerAddPlayer(connection); serverAddedPlayer.Invoke(connection); }
/// <summary> /// Called on clients when a servers tells the client it is no longer ready. /// <para>This is commonly used when switching scenes.</para> /// </summary> /// <param name="conn">Connection to the server.</param> internal void OnClientNotReady(INetworkConnection conn) { ClientNotReady.Invoke(conn); }
internal void OnAuthenticated(INetworkConnection conn) { Authenticated?.Invoke(conn); }
public override void OnServerConnect(NetworkConnection connection) { base.OnServerConnect(connection); clientConnectedToServer.Invoke(connection); }