[TYRUS-230] When Session is invalidated, the close reason is not 1006 Created: 08/Aug/13  Updated: 20/Feb/14  Resolved: 28/Aug/13

Status: Resolved
Project: tyrus
Component/s: None
Affects Version/s: 1.2.1
Fix Version/s: 1.3

Type: Bug Priority: Major
Reporter: jan.supol Assignee: stepan.kopriva
Resolution: Fixed Votes: 0
Labels: None
Remaining Estimate: Not Specified
Time Spent: Not Specified
Original Estimate: Not Specified

Issue Links:
is related to TYRUS-225 Invalidation of (Servlet) HttpSession... Resolved
is related to TYRUS-294 Close reason is not 1006 when connect... Resolved


Spec says (Section 2.1.5):

If the close was initiated by the local container, for example if the local
container determines the session has timed out, the local implementation must use the websocket protocol
close code 1006.

Having the following endpoint:

@ServerEndpoint(value = "/closesession")
public class WSCCloseSessionServer {
static int lastCloseCode = 0;
	public String onMessage(String msg, Session session) {
                if ("idle".equals(msg)) {
			lastCloseCode = 0;
		} else if ("code".equals(msg))
			msg = String.valueOf(lastCloseCode);
		return msg;
	public void onClose(CloseReason reason) {
		lastCloseCode = reason.getCloseCode().getCode();
		String msg = "Close code: " + lastCloseCode;

After request with "idle" message,
@OnClose writes down code 1000;

Generated at Fri Oct 21 00:32:42 UTC 2016 using JIRA 6.2.3#6260-sha1:63ef1d6dac3f4f4d7db4c1effd405ba38ccdc558.