Added support for HTTPS connections. Added support for custom HTTP request headers. Added EventSource state updates for OPEN and CLOSED.