Socket events

@jheretic just wanted to get your review on this before pushing