Backend API. Server-side code: this runs in a Codename One backend, not in the app on the device.
public interface HttpServer.WebSocketRoutes
Where websocket routes come from.
The server ASKS for them, once, while it is starting and before the listener
accepts anything. It is not a setter, and that is the point: this server is
event driven everywhere else – a Handler is called, a @RestController is
found by the build, Backend.Handlers is invoked with what the server
opened – and a mutable registry an application pokes at afterwards is a
different model bolted onto the side of it.
It also removes a race rather than documenting one. Registration that
happened after start returned left a window in which the listener was
already bound and a valid upgrade arriving in it fell through to the
ordinary HTTP handler, because the route it wanted did not exist yet.
A callback the server runs before it accepts cannot have that window.
Methods
public abstract void register(HttpServer.WebSocketRegistry registry)
throws Exception |
Method details
register
public abstract void register(HttpServer.WebSocketRegistry registry)
throws Exception