Basic event like dispatcher for sockets

Use a basic protocol Event: / Data: to format messages.
Adapted from https://gist.github.com/ismasan/299789
Dispatch events and receive data as json from server
Use a json data message format on socket