codemp/proto/cursor.proto

45 lines
942 B
Protocol Buffer
Raw Normal View History

2023-08-16 17:08:31 +02:00
syntax = "proto3";
package codemp.cursor;
// handle cursor events and broadcast to all users
2023-08-16 17:08:31 +02:00
service Cursor {
// send cursor movement to server
rpc Moved (CursorEvent) returns (MovedResponse);
// attach to a workspace and receive cursor events
rpc Listen (UserIdentity) returns (stream CursorEvent);
2023-08-16 17:08:31 +02:00
}
// empty request
2023-08-16 17:08:31 +02:00
message MovedResponse {}
// a tuple indicating row and column
message RowCol {
2023-08-16 17:08:31 +02:00
int32 row = 1;
int32 col = 2;
}
// cursor position object
2023-08-16 17:08:31 +02:00
message CursorPosition {
// path of current buffer this cursor is into
string buffer = 1;
// cursor start position
RowCol start = 2;
// cursor end position
RowCol end = 3;
}
// cursor event, with user id and cursor position
message CursorEvent {
// user moving the cursor
2023-08-16 17:08:31 +02:00
string user = 1;
// new cursor position
CursorPosition position = 2;
2023-08-16 17:08:31 +02:00
}
// payload identifying user for cursor attaching
2023-08-16 17:08:31 +02:00
message UserIdentity {
// user identifier
2023-08-16 17:08:31 +02:00
string id = 1;
}