# Converting curl "Event Stream" to node-RED

**URL:** <https://discourse.nodered.org/t/converting-curl-event-stream-to-node-red/76506>\
**Category:** General\
**Created:** [13 March 2023 10:02 UTC](https://discourse.nodered.org/t/converting-curl-event-stream-to-node-red/76506 "2023-03-13T10:02:29Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![lorccan](https://avatars.discourse-cdn.com/v4/letter/l/278dde/32.png) [@lorccan](https://discourse.nodered.org/u/lorccan)\
**Post date:** [13 March 2023 10:02 UTC](https://discourse.nodered.org/t/converting-curl-event-stream-to-node-red/76506/1 "2023-03-13T10:02:29Z")

</div>

Philips Hue has introduced a new api which includes functionality to receive an event stream ('Server-Sent-Events', or SSE). This obviates the need to poll the Hue bridge for device states.

"Subscribing" to SSE can be done with:

```auto
curl --insecure -N -H 'hue-application-key: <appkey>' -H 'Accept: text/event-stream' https://<ipaddress>/eventstream/clip/v2

```

so long as this connection is left open, events will arrive like this:

```auto
id: 1634576695:0
data: [{"creationtime":"2021-10-18T17:04:55Z","data":[{"id":"e706416a-8c92-46ef-8589-3453f3235b13","on":{"on":true},"owner":{"rid":"3f4ac4e9-d67a-4dbd-8a16-5ea7e373f281","rtype":"device"},"type":"light"}],"id":"9de116fc-5fd2-4b74-8414-0f30cb2cbe04","type":"update"}]

```

How can I implement the equivalent of this `curl` in node-RED? (I've had a go with http request, but I am not getting any responses. I should say that I have the appkey and server details and have proven all is working using curl.)

---

<div class="post-metadata">

**Author:** ![BartButenaers](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/bartbutenaers/32/10476_2.png) [@BartButenaers](https://discourse.nodered.org/u/BartButenaers)\
**Post date:** [13 March 2023 10:10 UTC](https://discourse.nodered.org/t/converting-curl-event-stream-to-node-red/76506/2 "2023-03-13T10:10:55Z")

</div>

@lorccan,

Perhaps [node-red-contrib-sse-client](https://github.com/bartbutenaers/node-red-contrib-sse-client) could be of any help? Don't know, because I don't use it myself...

Bart

---

<div class="post-metadata">

**Author:** ![lorccan](https://avatars.discourse-cdn.com/v4/letter/l/278dde/32.png) [@lorccan](https://discourse.nodered.org/u/lorccan)\
**Post date:** [13 March 2023 10:12 UTC](https://discourse.nodered.org/t/converting-curl-event-stream-to-node-red/76506/3 "2023-03-13T10:12:17Z")

</div>

Thanks Bart

Actually, I have just found NRC-philipshue-events which is exactly what I need. I should have searched inside NR first!

---

<div class="post-metadata">

**Author:** ![system](https://us1.discourse-cdn.com/flex026/uploads/nodered/original/1X/d073cd938eafa2e558d7c2cd59003b3ef4963033.png) [@system](https://discourse.nodered.org/u/system)\
**Post date:** [27 March 2023 10:12 UTC](https://discourse.nodered.org/t/converting-curl-event-stream-to-node-red/76506/4 "2023-03-27T10:12:38Z")

</div>

This topic was automatically closed 14 days after the last reply. New replies are no longer allowed.
