aboutsummaryrefslogtreecommitdiff
path: root/spark-common/src/main/proto/spark/spark_ws.proto
blob: 97b54807559664bbeef12fe2f3380ccc45861406 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
syntax = "proto3";

package spark;

import "spark/spark.proto";
import "spark/spark_sampler.proto";

option java_package = "me.lucko.spark.proto";
option java_outer_classname = "SparkWebSocketProtos";

message RawPacket {
  int32 version = 1;
  bytes public_key = 2;
  bytes signature = 3;
  bytes message = 4;
}

message PacketWrapper {
  oneof packet {
    // server -> client
    ServerPong server_pong = 1;
    ServerConnectResponse server_connect_response = 2;
    ServerUpdateSamplerData server_update_sampler = 3;
    ServerUpdateStatistics server_update_statistics = 4;

    // client -> server
    ClientPing client_ping = 10;
    ClientConnect client_connect = 11;
  }
}

// (signed) Sent from the server -> client in response to a ping
message ServerPong {
  bool ok = 1;
  int32 data = 2;
}

// (signed) Sent from the server -> client in response to a connection request
message ServerConnectResponse {
  string client_id = 1;
  State state = 2;
  Settings settings = 3;
  string last_payload_id = 4;

  enum State {
    ACCEPTED = 0;
    UNTRUSTED = 1;
    REJECTED = 2;
  }

  message Settings {
    int32 statistics_interval = 1;
    int32 sampler_interval = 2;
  }
}

// (signed) Sent from the server -> client when there is new sampler data
message ServerUpdateSamplerData {
  string payload_id = 1;
}

// (signed) Sent from the server -> client periodically to update statistics shown in widgets
message ServerUpdateStatistics {
  PlatformStatistics platform = 1;
  SystemStatistics system = 2;
}

// (unsigned) Sent from the client -> server on initial connection
message ClientConnect {
  string client_id = 1;
  string description = 2;
}

// (unsigned) Sent from the client -> server to check for responsiveness
message ClientPing {
  bool ok = 1;
  int32 data = 2;
}