Well, since the folks over at the forge forums are refusing to let fellow devs knowledge share about any version of forge older than 1.16x, I will start my thread here. I've got nowhere else to do it.
I am currently working on a mod that needs to listen to player connect/disconnect events. I am currently subscribing to both ServerDisconnectionFromClientEvent and PlayerLoggedOutEvent. For the most part, when the server is running normally the PlayerLoggedOutEvent is called. I haven't really found much on the ServerDisconnectionFromClientEvent, but my testing would suggest that this event is only raised when the server itself has an issue and forces the clients to disconnect - rather than the clients themselves disconnecting when they think the server is no longer responding. It just seems like sometimes during my testing when I let the debugger just sit there awhile (simulating the server not responding) the PlayerLoggedOutEvent is raised and other times ServerDisconnectionFromClientEvent
Here is my understanding of the events:
PlayerLoggedOutEvent is raised when a player manually returns to main menu, or when the client believes the server is not responding.
ServerDisconnectionFromClientEvent is raised when the server has an issue and is forcing players to disconnect. I'm not sure if it is always the case that the server is closing after this event, or if it can happen
on an otherwise healthy server, like maybe there was some issue sending packets to the client and the server doesn't think the client is there.
I'm not sure if my understanding is correct. I would like to have test cases for both events with several clients connected to the server, as I need to make sure that my code is working properly no matter the order in which people disconnect.
Some players cause effects on disconnecting, and some don't, so it's quite important to know if the logic is working properly in BOTH events.
Can anyone enlighten me on when exactly each event is raised, and how to force ServerDisconnectionFromClientEvent to be raised?
Well, since the folks over at the forge forums are refusing to let fellow devs knowledge share about any version of forge older than 1.16x, I will start my thread here. I've got nowhere else to do it.
I am currently working on a mod that needs to listen to player connect/disconnect events. I am currently subscribing to both ServerDisconnectionFromClientEvent and PlayerLoggedOutEvent. For the most part, when the server is running normally the PlayerLoggedOutEvent is called. I haven't really found much on the ServerDisconnectionFromClientEvent, but my testing would suggest that this event is only raised when the server itself has an issue and forces the clients to disconnect - rather than the clients themselves disconnecting when they think the server is no longer responding. It just seems like sometimes during my testing when I let the debugger just sit there awhile (simulating the server not responding) the PlayerLoggedOutEvent is raised and other times ServerDisconnectionFromClientEvent
Here is my understanding of the events:
PlayerLoggedOutEvent is raised when a player manually returns to main menu, or when the client believes the server is not responding.
ServerDisconnectionFromClientEvent is raised when the server has an issue and is forcing players to disconnect. I'm not sure if it is always the case that the server is closing after this event, or if it can happen
on an otherwise healthy server, like maybe there was some issue sending packets to the client and the server doesn't think the client is there.
I'm not sure if my understanding is correct. I would like to have test cases for both events with several clients connected to the server, as I need to make sure that my code is working properly no matter the order in which people disconnect.
Some players cause effects on disconnecting, and some don't, so it's quite important to know if the logic is working properly in BOTH events.
Can anyone enlighten me on when exactly each event is raised, and how to force ServerDisconnectionFromClientEvent to be raised?