Active Snap-2-snap communication Request

Hi there,

I am working on a project that requires communication among different snaps.
Specifically, there are two snaps SNAP_A and SNAP_B.
Once there is an event triggered in SNAP_A, it will send a signal (a binary signal for example) to SNAP_B, and SNAP_B will launch one of its applications, after successful launch of the application, SNAP_B will send SNAP_A a confirmation signal to confirm the app is launched successfully. This process follows a server-client model.

As far as I have known, currently the communication between snaps are done via interfaces, where a plug consumes the resources from a provide (slot). But I am not sure if it is one-way communication or two-way. After scanning through all common interfaces, I do not find anything that may fit my use case (correct me if I am wrong).

May I seek for your suggestion if designing a custom interface is a way to go or I need something else?

Thanks a lot!

D-Bus might be the easiest option here: there is an existing dbus snap interface that lets you specify the bus type (either system for a system wide service, or session for one running as the current user). When the two snaps are connected, the D-Bus daemon will allow traffic between them. This option will also take care of service activation for you, so you don’t need to worry about whether the service from SNAP_B is running when SNAP_A makes the call.

1 Like

…or alternatively use the network interface and have them talk via loopback networking through network ports :wink:

1 Like