blob: dda26de1803b4618f3d06420f2d693747f1a8b45 [file] [log] [blame]
// Copyright 2019 The Fuchsia Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
library fuchsia.firebase.messaging;
/// Client protocol created for a messaging client. This client is registered
/// and connected.
protocol Client {
/// Sends an upstream message to the service.
Send(struct {
message Message;
}) -> (struct {
error box<Error>;
});
/// Tells FCM backend to send connectivity events for this instance back to
/// the service. While FCM is always aware of connectivity events, the
/// service handling this device will only be notified if the events are
/// enabled and the service is signed up for them.
NotifyConnectivityEvents(struct {
events ConnectivityEvent;
});
// The following events will also be sent on this channel:
/// Wait for next message. Returns immediately if a message is waiting to be
/// consumed.
NextMessage() -> (struct {
message DownstreamMessage;
});
/// Blocks until an error is received. Returns exactly once for each error.
/// This includes errors specific to this particular app and service-wide
/// errors in the client multiplexer.
WaitForError() -> (struct {
error Error;
});
/// Returns on connection setup/reset. Connections are automatically
/// restarted on internal errors (eg. missing heartbeat ack, unexpected
/// login response). This call is just informational.
WaitForConnectionReset() -> ();
};