Merge pull request #6 from mike-stewart/master

Added heartbeat replies, fixed two bugs, and added logging.
Create an SSL socket for https connections.