Thursday, June 19, 2014

Chat it up!

With Project Venice, I am setting concrete goals for myself in order to keep the project moving.  The eventual goal is a playable prototype.  My first milestone was to create a working chat system.  This involves people to be able to log in, and send messages to each other.  It sounds simple, but I had to create an account system, and get client to server communications working.  So a lot of base work for future systems had to be put in place.

To handle the chat system, I leveraged Pusher.  Pusher is a web sockets Publish/Subscribe system which makes it very easy to handle real-time communications.  Clients subscribe to the global chat channel, and on the server side I send messages to the channel and everyone gets them. Very easy.  I could have had clients send messages directly to each other, but that has its drawbacks.  I need to sanitize what is sent, so going through the server is a necessity.  Don't need folks sending XSS and other such nastiness. 

I also implemented a Title system.  Everyone starts out with the title 'Citizen.'  You can change your title, if you had more than one.  Right now the title is just used in the chat system.  That's another reason I need to go through the server, so I can add title information.  

You can check it out (and test it) here:  http://venice.duckdns.org/signin  There probably won't be anyone to chat back, but if you see your message in the window, it worked.