This project helped me out: https://github.com/TomCools/dropwizard-websocket-jsr356-bundle.
If you are using Guice for DI, you'll want to add a Configurator:
ServerEndpointConfig serverEndpointConfig = ServerEndpointConfig.Builder.create(MyWebsocketServer.class,
"/my-ws-enpoint")
.configurator(new GuiceConfigurator())
.build();
class GuiceConfigurator extends ServerEndpointConfig.Configurator {
@Override
public <T> T getEndpointInstance(Class<T> endpointClass) throws InstantiationException {
return injector.getInstance(endpointClass);
}
}