Send large data to client #274
-
I'm trying to send a number of images to the client side of a custom component. Images update frequently and the application runs over a remote connection, so bandwidth is an issue. My first approach was to add the raw JPEG bytes into the component's options dictionary. But each time other options change, the whole dictionary is sent to the client, causing unnecessary traffic. I experimented with removing the image data once they arrived, but I still can't manage to avoid multiple transmissions. It should be possible to block updates as long as the client did not acknowledge the image transmission, but I already struggled for hours and the resulting implementation appears quite complex for such rather simple requirement. My next idea is to only transmit an ID or URL and let the client get the image via HTTP. But how can I define an image endpoint with JustPy? As far as I can tell, a jp.Route has to return a WebPage. Maybe I'm missing something completely obvious. But the documentation on https://justpy.io/tutorial/advanced_components/ only provides little insight into what is possible and how one is thought to approach things. |
Beta Was this translation helpful? Give feedback.
Replies: 1 comment 2 replies
-
Could you please elaborate why you would need a special component in this case? What is the functionality you need that only an advance component could provide? As for sending endpoints for images, please take a look at this example: https://justpy.io/tutorial/request_object/#dog-example While the request returns a webpage, you could use the request object to specify the src of images on a page. You could also use an event handler to add images to a page or change the src attribute of an image already on the page. |
Beta Was this translation helpful? Give feedback.
Could you please elaborate why you would need a special component in this case? What is the functionality you need that only an advance component could provide?
As for sending endpoints for images, please take a look at this example: https://justpy.io/tutorial/request_object/#dog-example
While the request returns a webpage, you could use the request object to specify the src of images on a page. You could also use an event handler to add images to a page or change the src attribute of an image already on the page.