From 8b4e963d39a127ca628e62a715e4c31b923f3077 Mon Sep 17 00:00:00 2001 From: Nikita Vilunov Date: Wed, 15 Feb 2023 11:35:05 +0100 Subject: [PATCH] context and sequence diagrams of sending a message --- docs/flow.md | 67 ++++++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 67 insertions(+) create mode 100644 docs/flow.md diff --git a/docs/flow.md b/docs/flow.md new file mode 100644 index 0000000..ef83f3c --- /dev/null +++ b/docs/flow.md @@ -0,0 +1,67 @@ +## 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") +```