connection_api.proto 3.0 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889
  1. // Copyright 2019 Google LLC.
  2. //
  3. // Licensed under the Apache License, Version 2.0 (the "License");
  4. // you may not use this file except in compliance with the License.
  5. // You may obtain a copy of the License at
  6. //
  7. // http://www.apache.org/licenses/LICENSE-2.0
  8. //
  9. // Unless required by applicable law or agreed to in writing, software
  10. // distributed under the License is distributed on an "AS IS" BASIS,
  11. // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
  12. // See the License for the specific language governing permissions and
  13. // limitations under the License.
  14. //
  15. syntax = "proto3";
  16. package google.firebase.fcm.connection.v1alpha1;
  17. import "google/api/annotations.proto";
  18. import "google/protobuf/timestamp.proto";
  19. option go_package = "google.golang.org/genproto/googleapis/firebase/fcm/connection/v1alpha1;connection";
  20. option java_multiple_files = true;
  21. option java_package = "com.google.firebase.fcm.connection.v1alpha1";
  22. // FCM's service to create client connections to send/receive messages.
  23. service ConnectionApi {
  24. // Creates a streaming connection with FCM to send messages and their
  25. // respective ACKs.
  26. //
  27. // The client credentials need to be passed in the [gRPC
  28. // Metadata](https://grpc.io/docs/guides/concepts.html#metadata). The Format
  29. // of the header is:
  30. // Key: "authorization"
  31. // Value: "Checkin [client_id:secret]"
  32. //
  33. //
  34. // The project's API key also needs to be sent to authorize the project.
  35. // That can be set in the X-Goog-Api-Key Metadata header.
  36. rpc Connect(stream UpstreamRequest) returns (stream DownstreamResponse) {
  37. }
  38. }
  39. // Request sent to FCM from the connected client.
  40. message UpstreamRequest {
  41. // The type of request the client is making to FCM.
  42. oneof request_type {
  43. // Message acknowledgement.
  44. Ack ack = 1;
  45. }
  46. }
  47. // Response sent to the connected client from FCM.
  48. message DownstreamResponse {
  49. // The type of response FCM is sending to the client.
  50. oneof response_type {
  51. // Message sent to FCM via the [Send
  52. // API](https://firebase.google.com/docs/cloud-messaging/send-message)
  53. // targeting this client.
  54. Message message = 1;
  55. }
  56. }
  57. // Acknowledgement to indicate a client successfully received an FCM message.
  58. //
  59. // If a message is not acked, FCM will continously resend the message until
  60. // it expires. Duplicate delivery in this case is working as intended.
  61. message Ack {
  62. // Id of message being acknowledged
  63. string message_id = 1;
  64. }
  65. // Message created through the [Send
  66. // API](https://firebase.google.com/docs/reference/fcm/rest/v1/projects.messages#resource-message).
  67. message Message {
  68. // The identifier of the message. Used to ack the message.
  69. string message_id = 1;
  70. // Time the message was received in FCM.
  71. google.protobuf.Timestamp create_time = 2;
  72. // Expiry time of the message. Currently it is always 4 weeks.
  73. google.protobuf.Timestamp expire_time = 3;
  74. // The arbitrary payload set in the [Send
  75. // API](https://firebase.google.com/docs/reference/fcm/rest/v1/projects.messages#resource-message).
  76. map<string, string> data = 4;
  77. }