✊🏿 Black Lives Matter. Please consider donating to Black Girls Code today.
🐇 Announcing Dash VTK for 3d simulation graphics. Check out the March webinar.

Trigger a callback using external resources like sockets

Hi, first of all thanks for this amazing framework.

I’m working in a machine learning project that process some data on the go and return a score and a image. Now I’m using a dash app to load the model and pass the arguments, and lately plot the score and the image, all in the same file.

This has worked perfectly but now I want to use the ml model in a separate process and pass the output for example via sockets. The purpose is to separate the model and the webapp, so the model can run alone and later the webapp can “subscribe” and receive the model outputs.

I have looked at RPyC library that allows me to call instances that run in server in the client side, and also use callbacks, so I think this would work.

The problem I realized is how can I trigger my update_figure method when receive the “socket callback” and not the “dash callback” . In others similar posts was talking about Celery framework but not sure if this is what I want or maybe this is an overkill.

Maybe a solution is just update the graphic manually using n_intervals, but I’m looking If I can use the external callback.

So I wonder some way to accomplish what I want in a simple manner

Thanks in advance,

Simon