Hi having issue trying to get eventSteam to work
the incoming request from the Hub looks like
GET /stream HTTP/1.1
Host: localhost:8081
User-Agent: okhttp/3.14.9
Accept: text/event-stream
Accept-Encoding: gzip
and the response
HTTP/1.1 200 OK
X-Powered-By: Express
Content-Type: text/event-stream
Connection: keep-alive
Cache-Control: no-cache
Date: Thu, 13 Aug 2020 23:32:42 GMT
Transfer-Encoding: chunked
every couple of seconds it prints
data: {"event":1}
I can see it steam in the browser but the HUB seems to be forever connected.
in the log I see this
dev:652020-08-14 00:40:03.956 warnstatus2
dev:652020-08-14 00:40:03.952 warnSTART: EventStream Started
dev:652020-08-14 00:40:03.948 warnstatus
but thats it.
my driver
definition (name: "Testing", namespace: "local-test", author: "test") {
command "streamStart", null
command "streamStop", null
}
void initialize(){
}
void parse(String description) {
log.warn("hi from parse")
log.warn(description)
}
void uninstalled() {
}
def eventStreamStatus(String msg) {
log.warn "status"
log.warn msg
log.warn "status2"
}
void streamStart() {
log.warn "streamStart"
try {
interfaces.eventStream.connect(
"http://my-host/stream",
[pingInterval: 5, headers:[Accept: "text/event-stream"]]
)
} catch(e) {
log.warn "error"
log.warn e
}
}
void streamStop() {
log.warn "streamStop"
interfaces.eventStream.close()
}
Am I missing something? thank you