How to push message to python client with websocket in java server

I hava lots of Raspberry PI what connected to a printer. A Tomcat host (build of Spring boot) in cloud.

When my host received a file, the Raspberry PI should download it and then print it out. Now, my solution is Polling: the Raspberry PI send requests to host per several seconds, certainly, polling is a bad way, then what's the best way? Is websocket ok? How about RPC? and the other way?

My goal is that the raspberry pi can download files as quickly as possible, and the server can withstand the pressure.

ps: Sorry for my poor English and thanks in advance.