The only point I'm not sure about is how the "handlers" solution stands against a pure websockets one. When should I prefer one over the other?
Just to make sure that it is clear, you can combine both standard handlers and websocket handlers in the same server.
Using WebSockets vs regular handlers in a backend server (not the same considerations as in a web app)
If you want to keep an open and symmetric connection between the server and client then use websockets (this includes the ability to push data from the server to the client).
If a "request -> response" flow is good enough then use regular handlers.
Remember that WebSockets work with strings instead of raw bytes. If you want to send serialized objects (with B4XSerializator) then you will need to encode the data with base 64 encoding.
I will give you a real example. The B4i Mac builders are implemented with B4J. With the exception of a single task all the tasks are implemented with regular handlers.
For example the IDE sends the project and the server compiles it and does whatever it needs to do.
The device sends a request and the builder returns the ipa as required for over-the-air installation.
The exception is the "upload to app store" feature. It can take 5 or more minutes for this task to complete. Regular requests can timeout and then you need to implement a solution based on polling.
Instead the IDE opens a WebSocket connection to the server and keeps it open until the server sends a notification to the IDE that the process has completed.