chromium/components/mirroring/mojom/cast_message_channel.mojom

// Copyright 2018 The Chromium Authors
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.

module mirroring.mojom;

// Used for remoting-specific cast messages, currently only RPC.
const string kRemotingNamespace = "urn:x-cast:com.google.cast.remoting";

// Used for the majority of cast messages, including OFFER, ANSWER,
// GET_CAPABILITIES, CAPABILITIES_RESPONSE, and PRESENTATION (limited support).
const string kWebRtcNamespace = "urn:x-cast:com.google.cast.webrtc";

// Represents a control message for negotiating both mirroring and remoting cast
// sessions.
struct CastMessage {
  // The message namespace, restricted to either `kRemotingNamespace` or
  // `kWebRtcNamespace`.
  string message_namespace;

  // The message contents, formatted as a valid JSON string.
  string json_format_data;
};

// This interface is used for sending and receiving cast messages.
interface CastMessageChannel {
  // For outbound channels, this method may be called to send a cast message to
  // the Cast receiver. For inbound channels, this method is called whenever a
  // message is received from the Cast receiver.
  OnMessage(CastMessage message);
};