Skip to content

Chatserver Design Document

Josh Adams edited this page Aug 28, 2013 · 4 revisions

Planned Design

  • chatserver
    • Responds to the following messages:
      • { connect, { ServerPid, username } }
        • This will reject a connection if your username is already taken.
        • otherwise, the user is added to the 'list of connected users' in some fashion.
      • { quit, { ServerPid } }
      • { join, { ServerPid, channelname } }
        • Only allows a user to join the same channel once.
        • If you're the first user to join this channel, create the corresponding channel.
        • Proxy the join message on behalf of the sender to this channel (which is its own running OTP server)
      • { part, { ServerPid, channelname } }
        • Removes the user from the channel with that name.
        • If not in the channel or no channel by that name, 'succeed.'
  • channel
    • this is really the original design, as far as I can tell...

Original Design

The structure below represents the first "README-Driven Development" design doc the server was begun with. It's pretty clear from looking at it that it doesn't support "channels" or "rooms", and rather the thing I'm calling a chatserver below is really more like the channel concept, and there should be a different server that you initially connect to and that manages 'users' as opposed to 'users in this channel'.

  • chatserver
    • Responds to the following messages:
      • { join, { Pid, username }
      • { send, { Pid, message } }
      • { nicklist, Pid }
      • { part, Pid }
    • Supports the following records:
      • { state { listeners=[], messages=[] } }
      • { message, { username, text } }
      • { user, { username, pid } }

Clone this wiki locally