Adopted header elements
Close websocket if flush fails, otherwise the ws remains open forever
Added heartbeat functionality. This simply ignores a predefined string