- java.lang.Object
-
- swim.io.warp.WarpWebSocket
-
- All Implemented Interfaces:
PullContext<Envelope>
,StayContext
,FlowContext
,IpContext
,WarpSocketContext
,WebSocket<Envelope,Envelope>
public class WarpWebSocket extends Object implements WebSocket<Envelope,Envelope>, WarpSocketContext, PullContext<Envelope>, StayContext
-
-
Field Summary
Fields Modifier and Type Field Description protected WebSocketContext<Envelope,Envelope>
context
protected WarpSocket
socket
protected WarpSettings
warpSettings
-
Constructor Summary
Constructors Constructor Description WarpWebSocket(WarpSocket socket, WarpSettings warpSettings)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description void
become(IpSocket socket)
String
cipherSuite()
Returns the cryptographic cipher suite used by the underlying network connection.void
close()
void
didBecome(IpSocket socket)
void
didConnect()
void
didDisconnect()
void
didFail(Throwable error)
void
didRead(WsFrame<? extends Envelope> frame)
void
didSecure()
void
didTimeout()
void
didUpgrade(HttpRequest<?> httpRequest, HttpResponse<?> httpResponse)
void
didWrite(WsFrame<? extends Envelope> frame)
void
doRead()
void
doWrite()
void
feed(PullRequest<Envelope> pullRequest)
void
feed(Envelope envelope)
void
feed(Envelope envelope, float prio)
FlowControl
flowControl()
Returns the currentFlowControl
state of the underlying network channel.void
flowControl(FlowControl flowControl)
Enqueues an atomic replacement of the underlying network channel's flow control state with a newflowControl
.FlowControl
flowControl(FlowModifier flowModifier)
Enqueues an atomic modification to the underlying network channel's flow control state by applying aflowModifier
delta.protected void
generateDemand()
long
idleTimeout()
boolean
isClient()
Returnstrue
if the underlying network channel initiated an outgoing connection.boolean
isConnected()
Returnstrue
if the underlying network channel is currently connected.boolean
isSecure()
Returnstrue
if the underlying network transport is encrypted.boolean
isServer()
Returnstrue
if the underlying network channel accepted an incoming connection.InetSocketAddress
localAddress()
Returns the IP address and port of the local endpoint of the underlying network connection.Collection<Certificate>
localCertificates()
Returns the certificate chain used to authenticate the local endpoint of the underlying network connection.Principal
localPrincipal()
Returns the authenticated identity of the local endpoint of the underlying network connection.void
push(Envelope envelope)
InetSocketAddress
remoteAddress()
Returns the IP address and port of the remote endpoint of the underlying network connection.Collection<Certificate>
remoteCertificates()
Returns the certificate chain used to authenticate the remote endpoint of the underlying network connection.Principal
remotePrincipal()
Returns the authenticated identity of the remote endpoint of the underlying network connection.String
securityProtocol()
Returns the name of the transport-layer security protocol used by the underlying network connection.void
setWebSocketContext(WebSocketContext<Envelope,Envelope> context)
void
skip()
WarpSettings
warpSettings()
WebSocketContext<Envelope,Envelope>
webSocketContext()
void
willBecome(IpSocket socket)
void
willConnect()
void
willSecure()
void
write(WsControlFrame<?,? extends Envelope> frame)
-
-
-
Field Detail
-
socket
protected final WarpSocket socket
-
warpSettings
protected final WarpSettings warpSettings
-
context
protected WebSocketContext<Envelope,Envelope> context
-
-
Constructor Detail
-
WarpWebSocket
public WarpWebSocket(WarpSocket socket, WarpSettings warpSettings)
-
-
Method Detail
-
webSocketContext
public WebSocketContext<Envelope,Envelope> webSocketContext()
- Specified by:
webSocketContext
in interfaceWebSocket<Envelope,Envelope>
-
setWebSocketContext
public void setWebSocketContext(WebSocketContext<Envelope,Envelope> context)
- Specified by:
setWebSocketContext
in interfaceWebSocket<Envelope,Envelope>
-
idleTimeout
public long idleTimeout()
- Specified by:
idleTimeout
in interfaceWebSocket<Envelope,Envelope>
-
didUpgrade
public void didUpgrade(HttpRequest<?> httpRequest, HttpResponse<?> httpResponse)
- Specified by:
didUpgrade
in interfaceWebSocket<Envelope,Envelope>
-
willConnect
public void willConnect()
- Specified by:
willConnect
in interfaceWebSocket<Envelope,Envelope>
-
didConnect
public void didConnect()
- Specified by:
didConnect
in interfaceWebSocket<Envelope,Envelope>
-
willSecure
public void willSecure()
- Specified by:
willSecure
in interfaceWebSocket<Envelope,Envelope>
-
didSecure
public void didSecure()
-
willBecome
public void willBecome(IpSocket socket)
- Specified by:
willBecome
in interfaceWebSocket<Envelope,Envelope>
-
didBecome
public void didBecome(IpSocket socket)
-
didTimeout
public void didTimeout()
- Specified by:
didTimeout
in interfaceWebSocket<Envelope,Envelope>
-
didDisconnect
public void didDisconnect()
- Specified by:
didDisconnect
in interfaceWebSocket<Envelope,Envelope>
-
didFail
public void didFail(Throwable error)
-
isConnected
public boolean isConnected()
Description copied from interface:IpContext
Returnstrue
if the underlying network channel is currently connected.- Specified by:
isConnected
in interfaceIpContext
-
isClient
public boolean isClient()
Description copied from interface:IpContext
Returnstrue
if the underlying network channel initiated an outgoing connection.
-
isServer
public boolean isServer()
Description copied from interface:IpContext
Returnstrue
if the underlying network channel accepted an incoming connection.
-
isSecure
public boolean isSecure()
Description copied from interface:IpContext
Returnstrue
if the underlying network transport is encrypted.
-
securityProtocol
public String securityProtocol()
Description copied from interface:IpContext
Returns the name of the transport-layer security protocol used by the underlying network connection. Returnsnull
if the underlying network channel is not currently connected, or if the underlying network connection is not secure.- Specified by:
securityProtocol
in interfaceIpContext
-
cipherSuite
public String cipherSuite()
Description copied from interface:IpContext
Returns the cryptographic cipher suite used by the underlying network connection. Returnsnull
if the underlying network channel is not currently connected, or if the underlying network connection is not secure.- Specified by:
cipherSuite
in interfaceIpContext
-
localAddress
public InetSocketAddress localAddress()
Description copied from interface:IpContext
Returns the IP address and port of the local endpoint of the underlying network connection. Returnsnull
if the underlying network channel is not currently connected.- Specified by:
localAddress
in interfaceIpContext
-
localPrincipal
public Principal localPrincipal()
Description copied from interface:IpContext
Returns the authenticated identity of the local endpoint of the underlying network connection. Returnsnull
if the underlying network channel is not currently connected, or if the underlying network connection is not authenticated.- Specified by:
localPrincipal
in interfaceIpContext
-
localCertificates
public Collection<Certificate> localCertificates()
Description copied from interface:IpContext
Returns the certificate chain used to authenticate the local endpoint of the underlying network connection. Returnsnull
if the underlying network channel is not currently connected, or if the underlying network connection is not authenticated.- Specified by:
localCertificates
in interfaceIpContext
-
remoteAddress
public InetSocketAddress remoteAddress()
Description copied from interface:IpContext
Returns the IP address and port of the remote endpoint of the underlying network connection. Returnsnull
if the underlying network channel is not currently connected.- Specified by:
remoteAddress
in interfaceIpContext
-
remotePrincipal
public Principal remotePrincipal()
Description copied from interface:IpContext
Returns the authenticated identity of the remote endpoint of the underlying network connection. Returnsnull
if the underlying network channel is not currently connected, or if the underlying network connection is not authenticated.- Specified by:
remotePrincipal
in interfaceIpContext
-
remoteCertificates
public Collection<Certificate> remoteCertificates()
Description copied from interface:IpContext
Returns the certificate chain used to authenticate the remote endpoint of the underlying network connection. Returnsnull
if the underlying network channel is not currently connected, or if the underlying network connection is not authenticated.- Specified by:
remoteCertificates
in interfaceIpContext
-
flowControl
public FlowControl flowControl()
Description copied from interface:FlowContext
Returns the currentFlowControl
state of the underlying network channel.- Specified by:
flowControl
in interfaceFlowContext
-
flowControl
public void flowControl(FlowControl flowControl)
Description copied from interface:FlowContext
Enqueues an atomic replacement of the underlying network channel's flow control state with a newflowControl
.- Specified by:
flowControl
in interfaceFlowContext
-
flowControl
public FlowControl flowControl(FlowModifier flowModifier)
Description copied from interface:FlowContext
Enqueues an atomic modification to the underlying network channel's flow control state by applying aflowModifier
delta.- Specified by:
flowControl
in interfaceFlowContext
-
warpSettings
public WarpSettings warpSettings()
- Specified by:
warpSettings
in interfaceWarpSocketContext
-
feed
public void feed(PullRequest<Envelope> pullRequest)
- Specified by:
feed
in interfaceWarpSocketContext
-
feed
public void feed(Envelope envelope, float prio)
- Specified by:
feed
in interfaceWarpSocketContext
-
feed
public void feed(Envelope envelope)
- Specified by:
feed
in interfaceWarpSocketContext
-
push
public void push(Envelope envelope)
- Specified by:
push
in interfacePullContext<Envelope>
-
skip
public void skip()
- Specified by:
skip
in interfacePullContext<Envelope>
-
generateDemand
protected void generateDemand()
-
write
public void write(WsControlFrame<?,? extends Envelope> frame)
- Specified by:
write
in interfaceWarpSocketContext
-
become
public void become(IpSocket socket)
- Specified by:
become
in interfaceWarpSocketContext
-
close
public void close()
- Specified by:
close
in interfaceWarpSocketContext
-
-