code: public ReadyState getReadyState() {
          if (stream == null) {
              return EventSource.ReadyState.CONNECTING;
          }
          else {
              switch (stream.getReadyState()) {
              case CONNECTING:
                  return EventSource.ReadyState.CONNECTING;
                  
              case OPEN:
                  return EventSource.ReadyState.OPEN;
  
              case CLOSING:
              case CLOSED:
              default:
                  return EventSource.ReadyState.CLOSED;
              }
          }        
      }
docs: The ready state indicates the stream status, Possible values are 0 (CONNECTING), 1 (OPEN) and 2 (CLOSED)
  
  @return current state