Custom module, Canvas widget or parallel app/window to draw a custom GUI and transmis OSC messages?

Hello,

I have started to design some custom code in JS (with P5js) with a specific GUI. I am wondering what would be the best way to integrate this with O-S-C. The possible solutions I see are:

  • custom module;
  • canvas module;
  • separate app/GUI in another window.

As I understand, both the custom and canvas modules allow one to use the server to transmit OSC message, but could they both also receive messages from the other widgets and control them? On one hand, the question is: can I import code with NPM if I choose one of these solutions (for instance to use p5js to draw elements) ? On the other hand, if I prefer to set a parallel GUI (for instance in a separate browser window) with a separate Node.js installation, would I have access to O-S-C functions to receive/transmit OSC messages from this window or should I install another OSC library in this separate Node.js installation? Or maybe could I use the Node.js embedded in O-S-C and even install additional libraries into it and use them in the browser?

I know, this is a lot of questions... :crazy_face:

As I understand, both the custom and canvas modules allow one to use the server to transmit OSC message, but could they both also receive messages from the other widgets and control them? On one hand, the question is: can I import code with NPM if I choose one of these solutions (for instance to use p5js to draw elements) ?

Importing npm libs is possible on the server side only (in a custom module).

Drawing into a canvas from the custom module is sort of possible but not quite as straightforward as you might think : Help with emulating an LCD - #3 by konsumer

On the other hand, if I prefer to set a parallel GUI (for instance in a separate browser window)

You can open multiple separate sessions with a single server instance running (and a single custom module), this is probably much simpler.

Does it change anything to the situation if client and server are on the same device?

Also, do I get it right: if I made a custom module I could use a third-party NPM library in this module, be it in the same or another session?

Also, what about a frame container to load an HTML page and its dedicated JS to host the GUI?

Does it change anything to the situation if client and server are on the same device?

No it doesn't.

if I made a custom module I could use a third-party NPM library in this module, be it in the same or another session?

The custom module acts on the server's side so yes.

Also, what about a frame container to load an HTML page and its dedicated JS to host the GUI?

That's also possible but the embeded page won't have access to the client scripting context not will it be able to talk to the server out of the box.