Gio.Socket.prototype.is_connected

function is_connected(): Boolean {
    // Gjs wrapper for g_socket_is_connected()
}
  

Check whether the socket is connected. This is only useful for connection-oriented sockets.

Since 2.22

Returns

true if socket is connected, false otherwise.