Fuchsia Interface Definition Language (FIDL) is the language used to describe interprocess communication (IPC) protocols used by Fuchsia programs. FIDL provides a simplified declaration syntax for providers to define interfaces as a protocol. Supported data types include integers, floats, booleans, strings, and handles. These can be organized into more complex arrays, vectors, structs, tables, and unions.
Consider the following example FIDL protocol for an Echo
interface:
library fuchsia.examples; {% includecode gerrit_repo="fuchsia/fuchsia" gerrit_path="examples/fidl/fuchsia.examples/echo.test.fidl" region_tag="max" adjust_indentation="auto" %} {% includecode gerrit_repo="fuchsia/fuchsia" gerrit_path="examples/fidl/fuchsia.examples/echo.test.fidl" region_tag="echo" adjust_indentation="auto" %}
FIDL protocols describe a set of methods invoked by sending messages over a channel. Channel messages are inherently asynchronous, with the sender and receiver operating independently of each other. FIDL methods introduce higher-level semantics that enable more idiomatic programming on the client and server side of a FIDL transaction.
FIDL supports the following method types:
->
operator. Two-way methods block until a response is received. In the Echo
example, the EchoString()
method is a two-way method.Echo
example, the SendString()
method is a one-way method.->
operator. In the Echo
example, the OnString()
method is an event.Note: For more details on FIDL language syntax and supported types, see the FIDL Language specification.