Join GitHub today
GitHub is home to over 36 million developers working together to host and review code, manage projects, and build software together.Sign up
Connection Cycle Events
Below are a quick explanation of the various events that happen during the connection and acceptance cycles on both the server and the client. These events are accessible from
Server & Client Events
The below are events that are local-aware, that is to say that they are called without any need for an active connection.
Called when the local machine allowed the binding of the port requested.
Called when the local machine rejected the binding of the port requested.
Called when the local machine has completely disconnected from any communications in the Forge life cycle
The following events are called on the server only based on the behavior of clients connecting or disconnecting.
Called when a player has successfully connected with the server. This player CAN be rejected by the server, so this event is mainly useful for evaluation of the player or preparing anything you need for the player. You should not be communicating with the player at all until they have been accepted.
This event is called once the server has gotten the unique guid for a player. This triggers just before the accepted message and is useful to prepare any network player lookups.
This event is fired when the player has connected and successfully authenticates.
Fired when the player has been officially accepted by the server and now is the time you are able to start sending your messages to this player.
Fired when a player has been rejected for any reason by the server. This event will be expanded later but currently is used for when a client has sent invalid connection headers.
Called when a player has timed out on the server. This happens after they have been accepted and if the server hasn't received any message (ping or otherwise) from the specified client. The timeout time (in milliseconds) for a player can be found/set in the
Called at any time that a player has disconnected on its own or by the server.
The following events are called on the client only and deal with the various connection events that relate to this client and the server.
Called whenever the server has accepted this client. At this point it is safe to start sending messages to the server and to know it is a live connection.
Remember that serverAccepted, fires on connection with the server, so you need to subscribe to it, before the client connects. Otherwise, serverAccepted will fire before your listener is subscribed. Hence, do subscribe on it after the client is made and before the connection with a server is established!
Called if the client cannot connect to the server. The client will make 10 connect attempts, waiting 3 seconds between attempts, then call this event if none of the connection attempts were successful.