/** * Enqueue a close frame. * * @param statusCode * the WebSocket status code. * @param reason * the (optional) reason string. (null is allowed) * @see StatusCode */ private void enqueClose(int statusCode, String reason) { synchronized (writeBytes) { // It is possible to get close events from many different sources. // Make sure we only sent 1 over the network. if (writeBytes.isClosed()) { // already sent the close return; } } CloseInfo close = new CloseInfo(statusCode,reason); // TODO: create DisconnectCallback? outgoingFrame(close.asFrame(),new OnCloseCallback()); }
/** * Enqueue a close frame. * * @param statusCode * the WebSocket status code. * @param reason * the (optional) reason string. (null is allowed) * @see StatusCode */ private void enqueClose(int statusCode, String reason) { synchronized (writeBytes) { // It is possible to get close events from many different sources. // Make sure we only sent 1 over the network. if (writeBytes.isClosed()) { // already sent the close return; } } CloseInfo close = new CloseInfo(statusCode,reason); // TODO: create DisconnectCallback? outgoingFrame(close.asFrame(),new OnCloseCallback()); }