Adding heartbeat, on socket close code and close reason, and refactoring code to use WebSocket enums

Adding heartbeat to the Phoenix JS socket
Allowing for closing code and closing reason to be passed to the web socket connection as mentioned here http://tools.ietf.org/html/rfc6455#section-7.4.1
Refactoring to use enums instead of hard coded values for connection status
Suggest assuming all times are in ms by default and losing the Ms suffix.
Or just name it heartbeatIntervalMs for consistency.