Java Code Examples for org.springframework.web.socket.sockjs.frame.SockJsFrame#getContentBytes()
The following examples show how to use
org.springframework.web.socket.sockjs.frame.SockJsFrame#getContentBytes() .
You can vote up the ones you like or vote down the ones you don't like,
and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: StreamingSockJsSession.java From spring-analysis-note with MIT License | 6 votes |
@Override protected void flushCache() throws SockJsTransportFailureException { while (!getMessageCache().isEmpty()) { String message = getMessageCache().poll(); SockJsMessageCodec messageCodec = getSockJsServiceConfig().getMessageCodec(); SockJsFrame frame = SockJsFrame.messageFrame(messageCodec, message); writeFrame(frame); this.byteCount += (frame.getContentBytes().length + 1); if (logger.isTraceEnabled()) { logger.trace(this.byteCount + " bytes written so far, " + getMessageCache().size() + " more messages not flushed"); } if (this.byteCount >= getSockJsServiceConfig().getStreamBytesLimit()) { logger.trace("Streamed bytes limit reached, recycling current request"); resetRequest(); this.byteCount = 0; break; } } scheduleHeartbeat(); }
Example 2
Source File: StreamingSockJsSession.java From java-technology-stack with MIT License | 6 votes |
@Override protected void flushCache() throws SockJsTransportFailureException { while (!getMessageCache().isEmpty()) { String message = getMessageCache().poll(); SockJsMessageCodec messageCodec = getSockJsServiceConfig().getMessageCodec(); SockJsFrame frame = SockJsFrame.messageFrame(messageCodec, message); writeFrame(frame); this.byteCount += (frame.getContentBytes().length + 1); if (logger.isTraceEnabled()) { logger.trace(this.byteCount + " bytes written so far, " + getMessageCache().size() + " more messages not flushed"); } if (this.byteCount >= getSockJsServiceConfig().getStreamBytesLimit()) { logger.trace("Streamed bytes limit reached, recycling current request"); resetRequest(); this.byteCount = 0; break; } } scheduleHeartbeat(); }
Example 3
Source File: StreamingSockJsSession.java From spring4-understanding with Apache License 2.0 | 6 votes |
@Override protected void flushCache() throws SockJsTransportFailureException { while (!getMessageCache().isEmpty()) { String message = getMessageCache().poll(); SockJsMessageCodec messageCodec = getSockJsServiceConfig().getMessageCodec(); SockJsFrame frame = SockJsFrame.messageFrame(messageCodec, message); writeFrame(frame); this.byteCount += (frame.getContentBytes().length + 1); if (logger.isTraceEnabled()) { logger.trace(this.byteCount + " bytes written so far, " + getMessageCache().size() + " more messages not flushed"); } if (this.byteCount >= getSockJsServiceConfig().getStreamBytesLimit()) { logger.trace("Streamed bytes limit reached, recycling current request"); resetRequest(); this.byteCount = 0; break; } } scheduleHeartbeat(); }