public.javadoc.org.spincast.core.websocket.WebsocketRouteBuilder.html Maven / Gradle / Ivy
Show all versions of spincast-website Show documentation
WebsocketRouteBuilder (org.spincast:spincast-framework 1.0.0 API)
org.spincast.core.websocket
Interface WebsocketRouteBuilder<R extends RequestContext<?>,W extends WebsocketContext<?>>
-
- All Known Implementing Classes:
- WebsocketRouteBuilderDefault
public interface WebsocketRouteBuilder<R extends RequestContext<?>,W extends WebsocketContext<?>>
Builder for WebSocket routes.
-
-
Method Summary
All Methods Instance Methods Abstract Methods
Modifier and Type
Method and Description
WebsocketRouteBuilder<R,W>
before(Handler<R> beforeFilter)
Adds a before filter.
WebsocketRoute<R,W>
create(WebsocketController<R,W> websocketController)
Creates and returns the WebSocket route without adding it to
the router.
void
handle(WebsocketController<R,W> websocketController)
Saves the WebSocket route on the router.
WebsocketRouteBuilder<R,W>
id(String id)
The WebSocket route id.
WebsocketRouteBuilder<R,W>
path(String path)
The path that trigger the beginning of that
HTTP to WebSocket connection.
WebsocketRouteBuilder<R,W>
skip(String beforeFilterId)
Skip a "before" filter for this WebSocket route
("after" filters are never run).
WebsocketRouteBuilder<R,W>
spicastCoreRouteOrPluginRoute()
This sould only by called by *plugins*.
-
-
Method Detail
-
path
WebsocketRouteBuilder<R,W> path(String path)
The path that trigger the beginning of that
HTTP to WebSocket connection.
-
id
WebsocketRouteBuilder<R,W> id(String id)
The WebSocket route id.
-
spicastCoreRouteOrPluginRoute
WebsocketRouteBuilder<R,W> spicastCoreRouteOrPluginRoute()
This sould only by called by *plugins*.
When this method is called, the resulting route won't
be remove by default when the
Router.removeAllRoutes()
method is used. The
Router.removeAllRoutes(boolean)
with true
will have to be called to actually remove it.
This is useful during development, when an hotreload mecanism
is used to reload the Router without
restarting the application, when the application routes changed.
By default only the routes for which the
#isSpicastCoreRouteOrPluginRoute()
method has been called would then be reloaded.
-
before
WebsocketRouteBuilder<R,W> before(Handler<R> beforeFilter)
Adds a before filter. Those will be run before the
WebSocket connection handshake is started.
Note that there are no "after" filters because once a
WebSocket connection is established, the HTTP one
is no more.
-
skip
WebsocketRouteBuilder<R,W> skip(String beforeFilterId)
Skip a "before" filter for this WebSocket route
("after" filters are never run).
This is useful when you set a global filter but want to skip
it one a specific route only.
-
handle
void handle(WebsocketController<R,W> websocketController)
Saves the WebSocket route on the router.
-
create
WebsocketRoute<R,W> create(WebsocketController<R,W> websocketController)
Creates and returns the WebSocket route without adding it to
the router.
NOTE : use save(...)
instead to save the route
to the router at the end of the build process!
Copyright © 2019. All rights reserved.