diff --git a/src/as/com/threerings/presents/client/Client.as b/src/as/com/threerings/presents/client/Client.as index c1dd2d79e..29b1c4ebb 100644 --- a/src/as/com/threerings/presents/client/Client.as +++ b/src/as/com/threerings/presents/client/Client.as @@ -234,6 +234,15 @@ public class Client extends EventDispatcher return (_clobj != null); } + /** + * Detects if the client is currently connected to the server. This can sometimes return false + * even though isLoggedOn returns true. + */ + public function isConnected () :Boolean + { + return _comm != null && _comm.isConnected(); + } + /** * Requests that this client connect and logon to the server with which it was previously * configured. diff --git a/src/as/com/threerings/presents/client/Communicator.as b/src/as/com/threerings/presents/client/Communicator.as index 4e07cd52a..3c4280cd7 100644 --- a/src/as/com/threerings/presents/client/Communicator.as +++ b/src/as/com/threerings/presents/client/Communicator.as @@ -85,6 +85,16 @@ public class Communicator } } + /** + * Detects if the communicator currently has an open channel to the server. This is guaranteed + * to return false while the logoff event is being dispatched. It also returns true during + * authentication, but prior to the client appearing to be logged on. + */ + public function isConnected () :Boolean + { + return _writer != null; + } + /** * Attempts to logon on using the port at the specified index. */