gogins / csound-webserver-opcodes

The "webserver" opcodes enable Csound to act as a local Web server that can host HTML5 GUIs and score generators.
GNU Lesser General Public License v2.1
0 stars 0 forks source link

Redo webkit-opcodes without embedding the browser #13

Closed gogins closed 2 years ago

gogins commented 2 years ago

The current implementation which uses an embedded WebKit browser has a big problem in that WebKit on macOS is not the same really as WebKit on Linux or Windows.

Redo these opcodes to use an arbitrary external browser (could be Chrome, Edge, Safari, Firefox, or whatever).

This should be possible because the current implementation embeds an XMLHttpRequest server in the C++ code of the opcodes already.

The new implementation should just shell out to launch the Web browser, which will load the Web page including the Csound stubs that will call the skeletons in the opcodes in the same way as currently.

Doing this with bidirectional WebSockets might be nicer but probably is not really necessary.

gogins commented 2 years ago

Check these out:

Did that, none of these are as suitable for this project as cpp-httplib and nlohmann/json, which I am using.

gogins commented 2 years ago

The basic logic is:

gogins commented 2 years ago

Off the top of my head, I don't like using shared libraries in this context, so that leaves Civetweb, Oat++, and Dragon. It's nice that Civitweb is designed to be embedded and one can just pop its sources into one's project, but then again it's not so bad to simply build the others and just use their headers and static libs in place. Civetweb seems somewhat less popular, the other two appear well regarded and more popular.

gogins commented 2 years ago

The more I look at these libraries, the more I wonder if this is really a good idea. The libraries are oriented towards REST services and I have only seen one example of serving a static HTML file, which is basically what I need to do. I don't know what happens with other resources linked to by the static file. But it is easy to tell.

gogins commented 2 years ago

It seems to work to just use the jQuery $.ajax function with my existing stubs, then implement skeletons by hand and bind the interface on the same port as the static Web server. I will fill out the APIs and implement a real example based on this assumption.

gogins commented 2 years ago

I am closing this and will open separate issues for testing, examples, and packaging with GitHub Actions.