/** * Internal * * @param frame * the frame to write * @return the future for the network write of the frame */ private Future<Void> sendAsyncFrame(WebSocketFrame frame) { FutureWriteCallback future = new FutureWriteCallback(); try { connection.getIOState().assertOutputOpen(); outgoing.outgoingFrame(frame,future); } catch (IOException e) { future.writeFailed(e); } return future; }
/** * Internal * * @param frame * the frame to write * @return the future for the network write of the frame */ private Future<Void> sendAsyncFrame(WebSocketFrame frame) { FutureWriteCallback future = new FutureWriteCallback(); try { connection.getIOState().assertOutputOpen(); outgoing.outgoingFrame(frame,future); } catch (IOException e) { future.writeFailed(e); } return future; }
public void uncheckedSendFrame(WebSocketFrame frame, WriteCallback callback) { try { BatchMode batchMode = BatchMode.OFF; if (frame.isDataFrame()) batchMode = getBatchMode(); connection.getIOState().assertOutputOpen(); outgoing.outgoingFrame(frame, callback, batchMode); } catch (IOException e) { callback.writeFailed(e); } }
/** * Blocking write of bytes. */ @Override public void sendBytes(ByteBuffer data) throws IOException { connection.getIOState().assertOutputOpen(); if (LOG.isDebugEnabled()) { LOG.debug("sendBytes with {}",BufferUtil.toDetailString(data)); } WebSocketFrame frame = WebSocketFrame.binary().setPayload(data); blockingWrite(frame); }
/** * Blocking write of bytes. */ @Override public void sendBytes(ByteBuffer data) throws IOException { connection.getIOState().assertOutputOpen(); if (LOG.isDebugEnabled()) { LOG.debug("sendBytes with {}",BufferUtil.toDetailString(data)); } WebSocketFrame frame = WebSocketFrame.binary().setPayload(data); blockingWrite(frame); }
/** * Blocking write of bytes. */ @Override public void sendBytes(ByteBuffer data) throws IOException { lockMsg(MsgType.BLOCKING); try { connection.getIOState().assertOutputOpen(); if (LOG.isDebugEnabled()) { LOG.debug("sendBytes with {}", BufferUtil.toDetailString(data)); } blockingWrite(new BinaryFrame().setPayload(data)); } finally { unlockMsg(MsgType.BLOCKING); } }