Client-server architecture

This change reworks the Mocket API to more closely match the real Socket.IO API.