Jetty Logo
Version: 9.4.5.v20170502
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

WebSocket Session

The Session object can be used to:

The Connection State (is it open or not).

if(session.isOpen()) {
  // send message
}

Is the Connection Secure.

if(session.isSecure()) {
  // connection is using 'wss://'
}

What was in the Upgrade Request and Response.

UpgradeRequest req = session.getUpgradeRequest();
String channelName = req.getParameterMap().get("channelName");

UpgradeRespons resp = session.getUpgradeResponse();
String subprotocol = resp.getAcceptedSubProtocol();

What is the Local and Remote Address.

InetSocketAddress remoteAddr = session.getRemoteAddress();

Get and Set the Idle Timeout

session.setIdleTimeout(2000); // 2 second timeout

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