This action terminates an active connection. It does not take any parameters.


Disconnecting cannot be prevented by the server, and occurs at the OS level. Your client closes the connection, instantly cutting off outgoing and incoming messages.

The server can close the connection on its end, which you as the client cannot prevent either.

Devices midway along the route can also cancel the connection, such as your router, and neither the server nor client can prevent it.


When the disconnect has happened, by your client's Disconnect action, or anything else, an Connection > On disconnect event is run. If the connection was started but not set up fully, the On Disconnect condition might not be triggered, but the connection will be closed anyway, ready for re-use.

(There are a couple scenarios where disconnection does not happen, see below.)


By disconnecting, the server is notified that the connection is over, and responds appropriately:

  • If a channel you were channel master of was set to auto-close, it is closed immediately, and all peers kicked from the channel and sent Channel > On channel leave messages.
    (They will not receive an On Peer Disconnect message beforehand.)
  • If a channel you were channel master on was not set to auto-close, or you are not the master, then a Channel > Peer > On peer disconnect message will be sent to other peers on that channel instead, and they will remain on the channel.
  • If you were the last person on a channel whether master or not, when leaving, the channel will be closed on the server's side.


There are scenarios where Disconnect does not trigger, despite you expecting it to.

  • If you are not sending any messages, and you unplug the Ethernet cable.
    When you do send something, it may take up to 30 seconds before the TCP connection times out and you finally get a disconnect event.
    This is due to the OS not telling the program when the adapter is unplugged, expecting it to be plugged back in shortly. So if you unplug, then quickly plug back in, you will keep the same connection!
    Conversely, you will stay connected indefinitely if you send nothing. However, after too long the server ping timer would have disconnected you, so once you plug it back in you'll get the disconnect event.
  • When the server program has frozen, without closing.
    The pending messages are silently queued at the OS level at the server side, delivered when the program resumes responding.
    While a client freezing will result in the server ping timer disconnecting the client, the Client objects do not have a ping timer, and so will stay connected to a frozen server anyway.
    Once the server resumes, things will proceed as normal. However, if the freeze is too long, the ping timer will usually end up kicking all the clients once the server resumes, believing them to have been non-responsive during the freeze period.
    If the server program closes/crashes instead of resuming, then all clients will be disconnected as expected.