Jetty Logo
Version: 9.4.26.v20200117
Contact the core Jetty developers at

private support for your internal/customer projects ... custom extensions and distributions ... versioned snapshots for indefinite support ... scalability guidance for your apps and Ajax/Comet projects ... development services for sponsored feature development

Enabling WebSocket

To enable Websocket, you need to enable the websocket module.

Once this module is enabled for your Jetty base, it will apply to all webapps deployed to that base. If you want to be more selective about which webapps use Websocket, then you can:

Disable JSR-356 for a particular webapp
You can disable jsr-356 for a particular webapp by setting the context attribute org.eclipse.jetty.websocket.jsr356 to false. This will mean that websockets are not available to your webapp, however deployment time scanning for websocket-related classes such as endpoints will still occur. This can be a significant impost if your webapp contains a lot of classes and/or jar files. To completely disable websockets and avoid all setup costs associated with it for a particular webapp, use instead the context attribute org.eclipse.jetty.containerInitializerExclusionPattern, described next, which allows you to exclude the websocket ServletContainerInitializer that causes the scanning.
Completely disable jsr-356 for a particular webapp

Set the org.eclipse.jetty.containerInitializerExclusionPattern context attribute to include org.eclipse.jetty.websocket.jsr356.server.deploy.WebSocketServerContainerInitializer. Here’s an example of doing this in code, although you can do the same in xml:

WebAppContext context = new WebAppContext();

See an error or something missing? Contribute to this documentation at Github!(Generated: 2020-01-17)