blob: 100b5a1e23d1cc8b13d296b8dd2c9cb6d2b5ce48 [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.
closed protocol Client {
/// Sends an upstream message to the service.
strict 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.
strict 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.
strict 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.
strict 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.
strict WaitForConnectionReset() -> ();
};