`type state =`

1. `| CONNECTING`
2. `| OPEN`
3. `| CLOSED`

`class type 'a messageEvent = object ... end`
`class type eventSource = object ... end`
`class type options = object ... end`
`val withCredentials : bool -> options Js.t`
`val eventSource : (Js.js_string Js.t -> eventSource Js.t) Js.constr`
`val eventSource_options : (Js.js_string Js.t -> options Js.t -> eventSource Js.t) Js.constr`
`val addEventListener : (eventSource Js.t as 'a) -> 'b Dom.Event.typ -> ('a, 'b) Dom.event_listener -> bool Js.t -> Dom.event_listener_id`

Add an event listener. This function matches the `addEventListener` DOM method, except that it returns an id for removing the listener.