Flatchat Code Talk

Published Thursday, September 29, 2016

Flatchat is our in-house replacement for Slack, which we’ll be moving our users off soon.

Stats

  • maxing out at ~350-500 unique websockets
  • avg 200ms room load time

Check /pghero for db query diagnostics.

ssh into flatchat server for PM2 monitoring.

  • logs are rolled over every 7 days
  • pm2 monit for live resource usage
  • pm2 list for quick summary

Handling Message

  1. Validate inputs (flatchatter and room member)
  2. Check room policy
  3. Write message to db
  4. Add more stuff to message object (decorator?)
  5. Broadcast msg
    • to other users in room
    • to other rooms
  6. Send msg info to rabbitmq for processing

Details:

  • Room stored in session
  • User bounced if no access to room / no room