Added ping/pong.
Small cleanup, and stuff won't be sent if a connection is closed.
Version in the config is now the protocol version.