Version: 9.4.27.v20200227 |

Enabling WebSocket
Previous | Chapter 26. WebSocket Introduction Home | Next

##### Contact the core Jetty developers at www.webtide.com

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();
      context.setAttribute("org.eclipse.jetty.containerInitializerExclusionPattern",
                           "org.eclipse.jetty.websocket.jsr356.server.deploy.WebSocketServerContainerInitializer|com.acme.*");

Previous | Top | Next
WebSocket APIs | Home | Chapter 27. Jetty Websocket API

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