Gio.DBusServer::new-connection

connect('new-connection', function (dBusServer, connection: Gio.DBusConnection, ): Boolean);
  

Emitted when a new authenticated connection has been made. Use Gio.DBusConnection.prototype.get_peer_credentials to figure out what identity (if any), was authenticated.

If you want to accept the connection, take a reference to the connection object and return true. When you are done with the connection call Gio.DBusConnection.prototype.close and give up your reference. Note that the other peer may disconnect at any time - a typical thing to do when accepting a connection is to listen to the Gio.DBusConnection.closed signal.

If Gio.DBusServer.flags contains Gio.DBusServerFlags.run_in_thread then the signal is emitted in a new thread dedicated to the connection. Otherwise the signal is emitted in the [thread-default main context][g-main-context-push-thread-default] of the thread that @server was constructed in.

You are guaranteed that signal handlers for this signal runs before incoming messages on connection are processed. This means that it's suitable to call Gio.DBusConnection.prototype.register_object or similar from the signal handler.

Since 2.26

dBusServer

instance of Gio.DBusServer that is emitting the signal

connection

A Gio.DBusConnection for the new connection.

Returns

true to claim connection, false to let other handlers run.