Protocols

A FIDL protocol groups methods and events to describe how one process interacts with another over a channel.

library fuchsia.examples;

const MAX_STRING_LENGTH uint64 = 32;

@discoverable
protocol Echo {
    EchoString(struct {
        value string:MAX_STRING_LENGTH;
    }) -> (struct {
        response string:MAX_STRING_LENGTH;
    });
    SendString(struct {
        value string:MAX_STRING_LENGTH;
    });
    -> OnString(struct {
        response string:MAX_STRING_LENGTH;
    });
};

Note: For more details on FIDL protocol syntax, see the FIDL language reference.

Protocol implementations are served from provider components using the outgoing directory and consumed from another component's namespace.

For example, the implementation of the fuchsia.examples.Echo protocol above would be present in a component's namespace at the path /svc/fuchsia.examples.Echo.

Routing

Protocols are routed to components through protocol capabilities.