Erstwhile Okie on St. Mark's Place. "That which hath been is now; and that which is to be hath already been; and God requireth that which is past."
Finally tackled getting websockets integrated into the site, which was way easier than I'd worried it might be. My email client (mentioned earlier) worked by writing received emails to the site's database. So when I would come onto the site, it queried the database for the emails (a pretty big pull) then displayed them. Then, every minute, the site would query the database again, another big pull, to see if there were new ones.
I could get away with these frequent, big lifts, because I'm the only one doing them, so it didn't have to scale. But it was still awful practice, and could be really slow too. I would also re-query the database every time I reloaded my inbox after deleting an email, reading an email, etc...
Now, with websockets, I make a single query when I first load the site. After that, every time my server receives a new email, it sends it to my browser, which then just slips it into the top of my inbox, rather than having to reload the whole inbox.
With the websockets integrated, I was able to refactor the whole email component, reducing the lines of code dramatically, in addition to now having a much, much faster client, and a database getting bothered a lot less frequently.
