Package org.xwiki.websocket.script
Class WebSocketScriptService
- java.lang.Object
-
- org.xwiki.websocket.script.WebSocketScriptService
-
- All Implemented Interfaces:
org.xwiki.script.service.ScriptService
@Component @Named("websocket") @Singleton public class WebSocketScriptService extends Object implements org.xwiki.script.service.ScriptService
Script-related WebSocket APIs.- Since:
- 13.7RC1
- Version:
- $Id: fedcf6e9f718259f928a8c17923f75d713800c74 $
-
-
Constructor Summary
Constructors Constructor Description WebSocketScriptService()
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description String
url(String pathOrRoleHint)
Computes the URL to access a WebSocket end-point.
-
-
-
Method Detail
-
url
public String url(String pathOrRoleHint)
Computes the URL to access a WebSocket end-point. We support two types of end-points:- statically registered: are registered when the web application is deployed so they can't be removed or added
dynamically at runtime (without a server restart); they are mapped to an URL like this:
ws://<host>/<webAppContextPath>/websocket/<endPointPath>
(e.g.ws://localhost:8080/xwiki/websocket/echo
); in order to get the URL to such an end-point you need to pass to this method only the/<endPointPath>
(e.g./echo
) - dynamically registered: can be added or removed at runtime (e.g. by installing or uninstalling extensions,
without a server restart); they are mapped to an URL like this:
ws://<host>/<webAppContextPath>/websocket/<wiki>/<endPointRoleHint>
(e.g.ws://localhost:8080/xwiki/websocket/dev/echo
); notice the wiki path parameter which is needed in order to look for the end-point component in the right namespace; in order to get the URL to such an end-point you need to pass to this method the<endPointRoleHint>
(e.g.echo
, if the end-point component has@Named("echo")
)
- Parameters:
pathOrRoleHint
- either the path a statically registered WebSocket end-point is mapped to (must start with slash/
), or the role hint of a dynamically registered end-point (must not start with slash/
)- Returns:
- the URL to access the specified WebSocket end-point; statically registered end-points are identified by their path while dynamically registered end-points are identified by their role hint
- statically registered: are registered when the web application is deployed so they can't be removed or added
dynamically at runtime (without a server restart); they are mapped to an URL like this:
-
-