Added getChats stuff + tests + cleaned up sockets.js.