Javascript / Node.js wrapper or library

31 views
Skip to first unread message

Stefan Schmelz

unread,
Feb 28, 2021, 6:19:10 PM2/28/21
to open-lighting

Hi, I want to integrate a nodejs application with ola. Do you know of a library or a wrapper around the sreaming client? I would prefer not making my own.


Thanks Stefan

Jannis Achstetter

unread,
Mar 1, 2021, 10:06:23 AM3/1/21
to open-l...@googlegroups.com
Hi Stefan,

I don't think that anyone did this yet but I like the idea.
Of course it's easy to access the data via HTTP calls but I assume you
need something more real-time since you already mentioned the streaming
client.

I could think of two easy (= hacky) ways to achieve what you plan to do:
- Using a NodeJS Protobuf-Library and the proto-file from OLA. Then,
connect to your OLA instance (port 9010 by default, only listening on
127.0.0.1). Then you are talking to OLA like another client via Protobuf
- Use some kind of Node FFI (Foreign Function Interface, such as
https://www.npmjs.com/package/ffi-napi) to hook the OLA client library
and call functions of this library then

Best regards,
Jannis


Am 01.03.21 um 00:19 schrieb Stefan Schmelz:
> --
> The Open Lighting Project: open-l...@googlegroups.com, #openlighting
> (irc.freenode.org)
> To unsubscribe from this group, send email to
> open-lightin...@googlegroups.com
> For more options, visit https://groups.google.com/groups/opt_out?hl=en
> <https://groups.google.com/groups/opt_out?hl=en>
> ---
> You received this message because you are subscribed to the Google
> Groups "open-lighting" group.
> To unsubscribe from this group and stop receiving emails from it, send
> an email to open-lightin...@googlegroups.com
> <mailto:open-lightin...@googlegroups.com>.
> To view this discussion on the web visit
> https://groups.google.com/d/msgid/open-lighting/9f9b396c-dd73-4903-95d7-d84764483416n%40googlegroups.com
> <https://groups.google.com/d/msgid/open-lighting/9f9b396c-dd73-4903-95d7-d84764483416n%40googlegroups.com?utm_medium=email&utm_source=footer>.

Peter Newman

unread,
Mar 1, 2021, 11:54:58 AM3/1/21
to open-lighting
Hi Stefan,

Someone did this:

But it only supports sending DMX.

Do you just want to send, or receive too?

On Monday, 1 March 2021 at 15:06:23 UTC Kripton wrote:
Hi Stefan,

I don't think that anyone did this yet but I like the idea.
Of course it's easy to access the data via HTTP calls but I assume you
need something more real-time since you already mentioned the streaming
client.

I could think of two easy (= hacky) ways to achieve what you plan to do:
- Using a NodeJS Protobuf-Library and the proto-file from OLA. Then,
connect to your OLA instance (port 9010 by default, only listening on
127.0.0.1). Then you are talking to OLA like another client via Protobuf

Peter Newman

unread,
Mar 1, 2021, 11:56:23 AM3/1/21
to open-lighting

Stefan Schmelz

unread,
Mar 1, 2021, 12:10:42 PM3/1/21
to open-l...@googlegroups.com
Okay, the description of this package looked like it was a different thing.

But thangs very much for your reply

To unsubscribe from this group and stop receiving emails from it, send an email to open-lightin...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/open-lighting/7d8e3616-72b0-4347-bc5e-df352ba20d10n%40googlegroups.com.

Stefan Schmelz

unread,
Mar 1, 2021, 12:12:26 PM3/1/21
to open-l...@googlegroups.com
I should have looked at the github discussion first....

I only looked at the official docs. There was no mention of nodejs. 

To unsubscribe from this group and stop receiving emails from it, send an email to open-lightin...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/open-lighting/0862e335-4b62-4b2d-8dda-9b7bf8316c60n%40googlegroups.com.

Jannis Achstetter

unread,
Mar 1, 2021, 3:18:48 PM3/1/21
to open-l...@googlegroups.com
I had a brief look at it and it seems to be a wrapper around the HTTP
API (see
https://github.com/tfitschen/ola_node/blob/master/lib/dmx.coffee#L12).
While that works, it won't be performant.

Since Stefan was asking about the streaming client, I assume that
polling won't do the job for him.

Best regards,
Jannis


Am 01.03.21 um 17:54 schrieb Peter Newman:
> Hi Stefan,
>
> Someone did this:
> https://github.com/tfitschen/ola_node
>
> But it only supports sending DMX.
>
> Do you just want to send, or receive too?
>
> On Monday, 1 March 2021 at 15:06:23 UTC Kripton wrote:
>
> Hi Stefan,
>
> I don't think that anyone did this yet but I like the idea.
> Of course it's easy to access the data via HTTP calls but I assume you
> need something more real-time since you already mentioned the streaming
> client.
>
> I could think of two easy (= hacky) ways to achieve what you plan to
> do:
> - Using a NodeJS Protobuf-Library and the proto-file from OLA. Then,
> connect to your OLA instance (port 9010 by default, only listening on
> 127.0.0.1). Then you are talking to OLA like another client via Protobuf
>
>
> See http://docs.openlighting.org/ola/doc/latest/rpc_system.html for more
> detail
>
>
> - Use some kind of Node FFI (Foreign Function Interface, such as
> https://www.npmjs.com/package/ffi-napi
> <https://www.npmjs.com/package/ffi-napi>) to hook the OLA client
> library
> and call functions of this library then
>
> Best regards,
> Jannis
>
>
> Am 01.03.21 um 00:19 schrieb Stefan Schmelz:
> >
> > Hi, I want to integrate a nodejs application with ola. Do you know
> of a
> > library or a wrapper around the sreaming client? I would prefer not
> > making my own.
> >
> >
> > Thanks Stefan
> >
> > --
> > The Open Lighting Project: open-l...@googlegroups.com, #openlighting
> > (irc.freenode.org <http://irc.freenode.org>)
> > To unsubscribe from this group, send email to
> > open-lightin...@googlegroups.com
> > For more options, visit
> https://groups.google.com/groups/opt_out?hl=en
> <https://groups.google.com/groups/opt_out?hl=en>
> > <https://groups.google.com/groups/opt_out?hl=en
> <https://groups.google.com/groups/opt_out?hl=en>>
> > ---
> > You received this message because you are subscribed to the Google
> > Groups "open-lighting" group.
> > To unsubscribe from this group and stop receiving emails from it,
> send
> > an email to open-lightin...@googlegroups.com
> > <mailto:open-lightin...@googlegroups.com>.
> > To view this discussion on the web visit
> >
> https://groups.google.com/d/msgid/open-lighting/9f9b396c-dd73-4903-95d7-d84764483416n%40googlegroups.com
> <https://groups.google.com/d/msgid/open-lighting/9f9b396c-dd73-4903-95d7-d84764483416n%40googlegroups.com>
>
> >
> <https://groups.google.com/d/msgid/open-lighting/9f9b396c-dd73-4903-95d7-d84764483416n%40googlegroups.com?utm_medium=email&utm_source=footer
> <https://groups.google.com/d/msgid/open-lighting/9f9b396c-dd73-4903-95d7-d84764483416n%40googlegroups.com?utm_medium=email&utm_source=footer>>.
>
>
> --
> The Open Lighting Project: open-l...@googlegroups.com, #openlighting
> (irc.freenode.org)
> To unsubscribe from this group, send email to
> open-lightin...@googlegroups.com
> For more options, visit https://groups.google.com/groups/opt_out?hl=en
> <https://groups.google.com/groups/opt_out?hl=en>
> ---
> You received this message because you are subscribed to the Google
> Groups "open-lighting" group.
> To unsubscribe from this group and stop receiving emails from it, send
> an email to open-lightin...@googlegroups.com
> <mailto:open-lightin...@googlegroups.com>.
> To view this discussion on the web visit
> https://groups.google.com/d/msgid/open-lighting/7d8e3616-72b0-4347-bc5e-df352ba20d10n%40googlegroups.com
> <https://groups.google.com/d/msgid/open-lighting/7d8e3616-72b0-4347-bc5e-df352ba20d10n%40googlegroups.com?utm_medium=email&utm_source=footer>.

Stefan Schmelz

unread,
Mar 1, 2021, 3:23:16 PM3/1/21
to open-l...@googlegroups.com
Jannis, you are absolutely right. I would like to use it for Realtime applications. Despite Javascript being very slow. 

Stefan Schmelz <sschm...@gmail.com> schrieb am Mo., 1. März 2021, 00:19:

Hi, I want to integrate a nodejs application with ola. Do you know of a library or a wrapper around the sreaming client? I would prefer not making my own.


Thanks Stefan

--
The Open Lighting Project: open-l...@googlegroups.com, #openlighting (irc.freenode.org)
To unsubscribe from this group, send email to open-lightin...@googlegroups.com
For more options, visit https://groups.google.com/groups/opt_out?hl=en
---
You received this message because you are subscribed to the Google Groups "open-lighting" group.
To unsubscribe from this group and stop receiving emails from it, send an email to open-lightin...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/open-lighting/9f9b396c-dd73-4903-95d7-d84764483416n%40googlegroups.com.

Jannis Achstetter

unread,
Mar 1, 2021, 5:58:04 PM3/1/21
to open-l...@googlegroups.com
Nice, little evening challenge solved:
https://github.com/kripton/node-ola-protobuf

It's not a "library", more a kind of example. It's not doing exemplary
error handling and I didn't test it for performance. It might be useful
to you, or it might not be :)

DMX data is available after being updated here:
https://github.com/kripton/node-ola-protobuf/blob/main/index.ts#L71





It seems that the docs need a little update:
https://docs.openlighting.org/ola/doc/latest/rpc_system.html#rpc_SimpleExample
does not contain the "4 byte RPC header"
(https://docs.openlighting.org/ola/doc/latest/rpc_system.html#rpc_RPCHeader)
at all.

Best regards,
Jannis

Am 01.03.21 um 21:23 schrieb Stefan Schmelz:
> Jannis, you are absolutely right. I would like to use it for Realtime
> applications. Despite Javascript being very slow. 
>
> Stefan Schmelz <sschm...@gmail.com <mailto:sschm...@gmail.com>>
> schrieb am Mo., 1. März 2021, 00:19:
>
>
> Hi, I want to integrate a nodejs application with ola. Do you know
> of a library or a wrapper around the sreaming client? I would prefer
> not making my own.
>
>
> Thanks Stefan
>
> --
> The Open Lighting Project: open-l...@googlegroups.com
> <mailto:open-l...@googlegroups.com>, #openlighting
> (irc.freenode.org <http://irc.freenode.org>)
> To unsubscribe from this group, send email to
> open-lightin...@googlegroups.com
> <mailto:open-lighting%2Bunsu...@googlegroups.com>
> For more options, visit
> https://groups.google.com/groups/opt_out?hl=en
> <https://groups.google.com/groups/opt_out?hl=en>
> ---
> You received this message because you are subscribed to the Google
> Groups "open-lighting" group.
> To unsubscribe from this group and stop receiving emails from it,
> send an email to open-lightin...@googlegroups.com
> <mailto:open-lightin...@googlegroups.com>.
> <https://groups.google.com/d/msgid/open-lighting/9f9b396c-dd73-4903-95d7-d84764483416n%40googlegroups.com?utm_medium=email&utm_source=footer>.
>
> --
> The Open Lighting Project: open-l...@googlegroups.com, #openlighting
> (irc.freenode.org)
> To unsubscribe from this group, send email to
> open-lightin...@googlegroups.com
> For more options, visit https://groups.google.com/groups/opt_out?hl=en
> <https://groups.google.com/groups/opt_out?hl=en>
> ---
> You received this message because you are subscribed to the Google
> Groups "open-lighting" group.
> To unsubscribe from this group and stop receiving emails from it, send
> an email to open-lightin...@googlegroups.com
> <mailto:open-lightin...@googlegroups.com>.
> To view this discussion on the web visit
> https://groups.google.com/d/msgid/open-lighting/CAKJF573MQo2uo19teJBAGHOgD_-DLxwuzHLudurkHowzstG-BA%40mail.gmail.com
> <https://groups.google.com/d/msgid/open-lighting/CAKJF573MQo2uo19teJBAGHOgD_-DLxwuzHLudurkHowzstG-BA%40mail.gmail.com?utm_medium=email&utm_source=footer>.

Peter Newman

unread,
Mar 8, 2021, 6:32:13 PM3/8/21
to open-lighting
Replies inline.

On Monday, 1 March 2021 at 22:58:04 UTC Kripton wrote:
Nice, little evening challenge solved:
https://github.com/kripton/node-ola-protobuf

Nice work Jannis! Looks a lot simpler than some of our code, but I guess some of that is perhaps as it's not auto-generating lots of stuff.
 
It's not a "library", more a kind of example. It's not doing exemplary
error handling and I didn't test it for performance. It might be useful
to you, or it might not be :)

DMX data is available after being updated here:
https://github.com/kripton/node-ola-protobuf/blob/main/index.ts#L71





It seems that the docs need a little update:
https://docs.openlighting.org/ola/doc/latest/rpc_system.html#rpc_SimpleExample
does not contain the "4 byte RPC header"
(https://docs.openlighting.org/ola/doc/latest/rpc_system.html#rpc_RPCHeader)
at all.

Well spotted, we do seem to have it on the receive side, but indeed not on the transmit side. Do you fancy doing a PR to fix it? The documentation is here:
Reply all
Reply to author
Forward
0 new messages