Has anyone done anything with Websockets in Lua

I searched the forum but found nothing mentioning Websockets. I’m tempted to explore this, seeing if I can get a Lua Websocket thing running inside Renoise and communicating that way.

Has anyone already attempted something like this?

Are there any known roadblocks that would prevent this from working?

Maybe I don’t understand what Websockets means, but Renoise comes with a sort of HTTP server written with the Lua API. This is used to auto update tools.

Is this what you mean?

No (unless I’m missing something there), though that stuff might be handy.

Websockets allows for bi-directional communication over a TCP socket. It’s part of the current HTML5 spec so, for example, Web pages can act as clients and servers for assorted things (this is how the Leap Motion gesture controller can be used to manipulate Web pages; the page makes a Websocket connection to the Leap and gets gesture data events streamed to it).

I though I might use this library: GitHub - lipp/lua-websockets: Websockets for Lua.

This page might explain Websockets better: Introducing WebSockets - Bringing Sockets to the Web  |  Articles  |  web.dev

Thanks!

You can do bi-directional TCP communication with the Lua API as exists (The irc client tool is based on the same principle), but i notice your websocket Lua library is co-routine optimized, so it looks better using that than reinventing the wheel.

Plus there are existing tools that work with websockets and it is those I thought I could use to interact with Renoise.

But your comments have given me food for thought. Thanks!

Suva started a ‘webcontrol’ tool that worked via websocket some time ago. If he’s ok with it i can upload/send you the code.
(Not sure how complete the websocket implementation is tho.)

https://code.google.com/p/renoise-web-control/

Ooooh :)

Thanks!

Hardest part of websockets was the handshake. It required some cryptographic functionality, which I was fortunately able to find. Other than that, I think the implementation is lacking some handling for very long messages, I don’t remember the details exactly, but I remember I left some things unimplemented. Normally you don’t need them anyway.

I finally got around to trying this. Very, very slick. The demo page will start/stop the song but injectFunctions isn’t working for me. I’ll poke around to see what’s up.

Thanks for this!

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