## Sending a message ```mermaid sequenceDiagram participant Alice PC participant Alice Connection 1 participant Alice Phone participant Alice Connection 2 participant Alice participant Room participant Bob participant Bob Connection 1 participant Bob PC Alice PC->>Alice Connection 1: `PRIVMSG Room :Hello!` Alice Connection 1->>+Alice: PlayerCommand::SendMessage Alice->Alice: Check permissions Alice->>+Room: /send Room Hello! Alice-->>Alice Connection 1: fulfil promise Alice->>-Alice Connection 2: Updates::NewMessage Alice Connection 2->>Alice Phone: `:Alice PRIVMSG Room :Hello!` Room->>+Bob: Updates::NewMessage deactivate Room; Bob->>+Bob Connection 1: Updates::NewMessage deactivate Bob; Bob Connection 1->>-Bob PC: `:Alice PRIVMSG Room :Hello!` ``` ## Context ```mermaid C4Context System_Ext(AlicePC, "Alice PC", "Alice's PC") BiRel(AlicePC, AliceConn1, "IRC") System_Ext(AlicePh, "Alice Phone", "Alice's phone") BiRel(AlicePh, AliceConn2, "XMPP") Boundary(Node, "Node", "Single server process") { System(AliceConn1, "Alice Connection 1", "Projection nto an IRC socket") System(AliceConn2, "Alice Connection 2", "Projection onto an XMPP socket") BiRel(AliceConn1, Alice, "Cmds & updates") BiRel(AliceConn2, Alice, "Cmds & updates") Boundary(Core, "Core", "Core chat entities") { System(Alice, "Alice", "Player actor") System(Room1, "#room") BiRel(Alice, Room1, "") System(Bob, "Bob", "Player actor") BiRel(Bob, Room1, "") System(Players, "Player Registry", "") Rel(Players, Alice, "References") Rel(Players, Bob, "References") Rel(Players, Rooms, "") System(Rooms, "Room Registry", "") Rel(Rooms, Room1, "") } System(BobConn1, "Bob Connection 1", "Projection onto an IRC socket") BiRel(BobConn1, Bob, "Cmds & updates") } System_Ext(BobPC, "Bob PC", "Bob's PC") BiRel(BobPC, BobConn1, "IRC") UpdateLayoutConfig($c4ShapeInRow="3", $c4BoundaryInRow="1") ``` ## Cluster ```mermaid C4Context System_Ext(Alice, "Alice IRC") System_Ext(Bob, "Bob XMPP") Boundary(Lavina, "Lavina", "Cluster of nodes") { System(Node1, "Node 1", "Single server process") System(Node2, "Node 2", "Single server process") System(Node3, "Node 3", "Single server process") Rel(Node1, etcd, "") Rel(Node2, etcd, "") Rel(Node3, etcd, "") BiRel(Node1, Node2, "") BiRel(Node2, Node3, "") BiRel(Node1, Node3, "") System(etcd, "etcd", "Key-value store") UpdateLayoutConfig($c4ShapeInRow="2", $c4BoundaryInRow="1") } Rel(Alice, Node1, "") Rel(Bob, Node2, "") ```