Can't do the exciting work every day, even though I'm "doing my own thing". Well, I could, but then it might not be sustainable. After showing a project to a friend, he made me realize how vulnerable the system is, even to well-intentioned visitors, so I spent this week on some "hardening" and general software craftsmanship.

Along the way, I discovered PlantUML for visualizing the ensuing complexity. It's free (as in beer) software that can be used online, turning simple markup in to various kinds of diagrams. My diagram was generated with the following code:

@startuml
autonumber

alt Missing Authentication
  client -> "Room Controller": GET /room/:slug
  client <-- "Room Controller": Need Authentication
else With Authentication
  client -> "Room Controller": GET /room/:slug
  alt CCU > MAX
    "Room Controller" -> "client": 307 to error page
  else CCU <= MAX
    "Room Controller" -> "in-memory DB": insert Player
    "in-memory DB" --> "Room Controller": player_id
    "Room Controller" -> "Room Controller": Sign Token using player_id
    "Room Controller" --> client: 200 html with Token
    client -> "Socket": connect with Token
    "Socket" -> "Socket": Verify Token & remember player_id
    client -> "Socket": join Room Channel for {slug}
    "Room Channel" -> "in-memory DB": fetch complete World state
    "in-memory DB" --> "Room Channel": complete World state
    "Room Channel" --> "client": complete World state
    "client" -> "client": player action
    "client" -> "Room Channel": World diff
    "Room Channel" -> "in-memory DB": World diff
    "Room Channel" --> "other clients": World diff
  end
end

@enduml