forked from lavina/lavina
1
0
Fork 0
lavina/docs/flow.md

2.2 KiB

Sending a message

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

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")