I have this code
@ServerEndpoint(value = \"/websocket\")
public class Service {
private String clientId;
@OnOpen
public void init(Session sessi
Depends what do you mean by initialisation parameter. You can do something like this:
@ServerEndpoint(value = "/websocket/{clientId}")
public class Service {
private volatile String clientId;
@OnOpen
public void init(@PathParam("clientId") String clientId, Session session) throws IOException {
this.clientId = clientId;
}
}
Then you have do use following URL to access your endpoint: ws://host/contextPath/websocket/[clientId]
.
if you use query parameters, please see Session#getQueryString()
.