Skip to content

Commit

Permalink
add capnproto schema
Browse files Browse the repository at this point in the history
  • Loading branch information
kayhhh committed May 15, 2024
1 parent 4c4cbc8 commit 7c856c0
Show file tree
Hide file tree
Showing 2 changed files with 28 additions and 2 deletions.
3 changes: 1 addition & 2 deletions world/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -18,5 +18,4 @@ This DWN acts as a location for world discovery.

## Networking

Networking within an instance uses [WebTransport](https://developer.mozilla.org/en-US/docs/Web/API/WebTransport),
following a [protobuf](https://protobuf.dev/) specification.
Networking within an instance follows a [Cap'n Proto](https://capnproto.org/) schema over [WebTransport](https://developer.mozilla.org/en-US/docs/Web/API/WebTransport).
27 changes: 27 additions & 0 deletions world/schemas/world_server.capnp
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
@0xae09eca2c525e50a;

struct Result(T) {
union {
success @0: T;
error @1: Text;
}
}

interface WorldServer {
joinInstance @0 (instance: Instance) -> (response :Result(JoinResponse));

struct Instance {
recordId @0 :Text;
}

struct JoinResponse {
playerId @0: UInt16;
}

listPlayers @1 () -> (response: List(Player));

struct Player {
playerId @0: UInt16;
did @1: Text;
}
}

0 comments on commit 7c856c0

Please sign in to comment.