/** * Override to set the masker. */ @Override public void outgoingFrame(Frame frame, WriteCallback callback, BatchMode batchMode) { if (frame instanceof WebSocketFrame) { masker.setMask((WebSocketFrame)frame); } super.outgoingFrame(frame,callback, batchMode); }
/** * Overrride to set masker */ @Override public void outgoingFrame(Frame frame, WriteCallback callback) { if (frame instanceof WebSocketFrame) { if (masker == null) { ProtocolException ex = new ProtocolException("Must set a Masker"); LOG.warn(ex); if (callback != null) { callback.writeFailed(ex); } return; } masker.setMask((WebSocketFrame)frame); } super.outgoingFrame(frame,callback); }
/** * Overrride to set masker */ @Override public void outgoingFrame(Frame frame, WriteCallback callback) { if (frame instanceof WebSocketFrame) { if (masker == null) { ProtocolException ex = new ProtocolException("Must set a Masker"); LOG.warn(ex); if (callback != null) { callback.writeFailed(ex); } return; } masker.setMask((WebSocketFrame)frame); } super.outgoingFrame(frame,callback); }
/** * 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()); }