Use Shiny's websocket from external programs


This is more of a conceptual question.

I have Python program (QT interface) that I would like to link up with my Shiny application.
I have to call the Python program with an IPython kernel; so, I think it is not possible to use the reticulate package to transfer data from R to Python and back?

I am starting an ipython kernel with:

ipython kernel

And then do

    reticulate::use_condaenv("conda_env", required = TRUE)

    jupyter_client <- import("jupyter_client")
    cf <- jupyter_client$find_connection_file("KERNEL_ID")
    km <- jupyter_client$BlockingKernelClient(connection_file = cf)

    km$execute("... call python program")

Is there a way to use Shiny's websocket as a way for the two to communicate and exchange data?
My naive approach would be to save and load JSON files to exchange data and then use reactiveFileReader to read the data back into Shiny whenever the Python program makes a change.

Is there a better way to do this?


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

If you have a query related to it or one of the replies, start a new topic and refer back with a link.