public final class WebSocketConnection
extends java.lang.Object
WebSocketFrames.| Constructor and Description |
|---|
WebSocketConnection(io.reactivex.netty.channel.Connection<io.netty.handler.codec.http.websocketx.WebSocketFrame,io.netty.handler.codec.http.websocketx.WebSocketFrame> delegate) |
| Modifier and Type | Method and Description |
|---|---|
rx.Observable<java.lang.Void> |
close()
Flushes any pending writes and closes the connection.
|
rx.Observable<java.lang.Void> |
close(boolean flush)
Closes this channel after flushing all pending writes.
|
rx.Observable<java.lang.Void> |
closeListener()
Returns an
Observable that completes when this connection is closed. |
void |
closeNow()
Closes the connection immediately.
|
void |
flush()
Flushes all writes, if any, before calling the flush.
|
rx.Observable<io.netty.handler.codec.http.websocketx.WebSocketFrame> |
getInput()
Returns the input stream for this connection, until a
CloseWebSocketFrame is received. |
rx.Observable<io.netty.handler.codec.http.websocketx.WebSocketFrame> |
getInput(boolean untilCloseFrame)
Returns the input stream for this connection.
|
rx.Observable<java.lang.Void> |
write(rx.Observable<io.netty.handler.codec.http.websocketx.WebSocketFrame> msgs)
Writes a stream of frames on this connection.
|
rx.Observable<java.lang.Void> |
write(rx.Observable<io.netty.handler.codec.http.websocketx.WebSocketFrame> msgs,
rx.functions.Func1<io.netty.handler.codec.http.websocketx.WebSocketFrame,java.lang.Boolean> flushSelector)
On subscription of the returned
Observable, writes the passed message stream on the underneath channel
and flushes the channel, everytime, flushSelector returns true . |
rx.Observable<java.lang.Void> |
writeAndFlushOnEach(rx.Observable<io.netty.handler.codec.http.websocketx.WebSocketFrame> msgs)
On subscription of the returned
Observable, writes the passed message stream on the underneath channel
and flushes the channel, on every write. |
public WebSocketConnection(io.reactivex.netty.channel.Connection<io.netty.handler.codec.http.websocketx.WebSocketFrame,io.netty.handler.codec.http.websocketx.WebSocketFrame> delegate)
public rx.Observable<io.netty.handler.codec.http.websocketx.WebSocketFrame> getInput()
CloseWebSocketFrame is received. The terminal
CloseWebSocketFrame is included in the returned stream.@Beta public rx.Observable<io.netty.handler.codec.http.websocketx.WebSocketFrame> getInput(boolean untilCloseFrame)
untilCloseFrame is true then the returned stream
completes after receiving (and emitting) a CloseWebSocketFrame, otherwise, it completes with an error
when the underlying channel is closed.public rx.Observable<java.lang.Void> write(rx.Observable<io.netty.handler.codec.http.websocketx.WebSocketFrame> msgs)
write(Observable, Func1) or
writeAndFlushOnEach(Observable)msgs - Stream of frames to write.Observable representing the result of this write. Every subscription to this Observable
will replay the write on the channel.public rx.Observable<java.lang.Void> write(rx.Observable<io.netty.handler.codec.http.websocketx.WebSocketFrame> msgs,
rx.functions.Func1<io.netty.handler.codec.http.websocketx.WebSocketFrame,java.lang.Boolean> flushSelector)
Observable, writes the passed message stream on the underneath channel
and flushes the channel, everytime, flushSelector returns true . Any writes issued before
subscribing, will also be flushed. However, the returned Observable will not capture the result of those
writes, i.e. if the other writes, fail and this write does not, the returned Observable will not fail.msgs - Message stream to write.flushSelector - A Func1 which is invoked for every item emitted from msgs. Channel is
flushed, iff this function returns, true.Observable representing the result of this write. Every
subscription to this Observable will write the passed messages and flush all pending writes, when the
flushSelector returns truepublic rx.Observable<java.lang.Void> writeAndFlushOnEach(rx.Observable<io.netty.handler.codec.http.websocketx.WebSocketFrame> msgs)
Observable, writes the passed message stream on the underneath channel
and flushes the channel, on every write. Any writes issued before subscribing, will also be flushed. However, the
returned Observable will not capture the result of those writes, i.e. if the other writes, fail and this
write does not, the returned Observable will not fail.msgs - Message stream to write.Observable representing the result of this write. Every
subscription to this Observable will write the passed messages and flush all pending writes, on every
write.public void flush()
public rx.Observable<java.lang.Void> close()
close(true)Observable representing the result of close.public rx.Observable<java.lang.Void> close(boolean flush)
Observable representing the result of close and flush.public rx.Observable<java.lang.Void> closeListener()
Observable that completes when this connection is closed.Observable that completes when this connection is closed.public void closeNow()
close() and subscribing to the returned
Observable