- 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>contextprotected WarpSocketsocketprotected WarpSettingswarpSettings
-
Constructor Summary
Constructors Constructor Description WarpWebSocket(WarpSocket socket, WarpSettings warpSettings)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description voidbecome(IpSocket socket)StringcipherSuite()Returns the cryptographic cipher suite used by the underlying network connection.voidclose()voiddidBecome(IpSocket socket)voiddidConnect()voiddidDisconnect()voiddidFail(Throwable error)voiddidRead(WsFrame<? extends Envelope> frame)voiddidSecure()voiddidTimeout()voiddidUpgrade(HttpRequest<?> httpRequest, HttpResponse<?> httpResponse)voiddidWrite(WsFrame<? extends Envelope> frame)voiddoRead()voiddoWrite()voidfeed(PullRequest<Envelope> pullRequest)voidfeed(Envelope envelope)voidfeed(Envelope envelope, float prio)FlowControlflowControl()Returns the currentFlowControlstate of the underlying network channel.voidflowControl(FlowControl flowControl)Enqueues an atomic replacement of the underlying network channel's flow control state with a newflowControl.FlowControlflowControl(FlowModifier flowModifier)Enqueues an atomic modification to the underlying network channel's flow control state by applying aflowModifierdelta.protected voidgenerateDemand()longidleTimeout()booleanisClient()Returnstrueif the underlying network channel initiated an outgoing connection.booleanisConnected()Returnstrueif the underlying network channel is currently connected.booleanisSecure()Returnstrueif the underlying network transport is encrypted.booleanisServer()Returnstrueif the underlying network channel accepted an incoming connection.InetSocketAddresslocalAddress()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.PrincipallocalPrincipal()Returns the authenticated identity of the local endpoint of the underlying network connection.voidpush(Envelope envelope)InetSocketAddressremoteAddress()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.PrincipalremotePrincipal()Returns the authenticated identity of the remote endpoint of the underlying network connection.StringsecurityProtocol()Returns the name of the transport-layer security protocol used by the underlying network connection.voidsetWebSocketContext(WebSocketContext<Envelope,Envelope> context)voidskip()WarpSettingswarpSettings()WebSocketContext<Envelope,Envelope>webSocketContext()voidwillBecome(IpSocket socket)voidwillConnect()voidwillSecure()voidwrite(WsControl<?,? 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:
webSocketContextin interfaceWebSocket<Envelope,Envelope>
-
setWebSocketContext
public void setWebSocketContext(WebSocketContext<Envelope,Envelope> context)
- Specified by:
setWebSocketContextin interfaceWebSocket<Envelope,Envelope>
-
idleTimeout
public long idleTimeout()
- Specified by:
idleTimeoutin interfaceWebSocket<Envelope,Envelope>
-
didUpgrade
public void didUpgrade(HttpRequest<?> httpRequest, HttpResponse<?> httpResponse)
- Specified by:
didUpgradein interfaceWebSocket<Envelope,Envelope>
-
willConnect
public void willConnect()
- Specified by:
willConnectin interfaceWebSocket<Envelope,Envelope>
-
didConnect
public void didConnect()
- Specified by:
didConnectin interfaceWebSocket<Envelope,Envelope>
-
willSecure
public void willSecure()
- Specified by:
willSecurein interfaceWebSocket<Envelope,Envelope>
-
didSecure
public void didSecure()
-
willBecome
public void willBecome(IpSocket socket)
- Specified by:
willBecomein interfaceWebSocket<Envelope,Envelope>
-
didBecome
public void didBecome(IpSocket socket)
-
didTimeout
public void didTimeout()
- Specified by:
didTimeoutin interfaceWebSocket<Envelope,Envelope>
-
didDisconnect
public void didDisconnect()
- Specified by:
didDisconnectin interfaceWebSocket<Envelope,Envelope>
-
didFail
public void didFail(Throwable error)
-
isConnected
public boolean isConnected()
Description copied from interface:IpContextReturnstrueif the underlying network channel is currently connected.- Specified by:
isConnectedin interfaceIpContext
-
isClient
public boolean isClient()
Description copied from interface:IpContextReturnstrueif the underlying network channel initiated an outgoing connection.
-
isServer
public boolean isServer()
Description copied from interface:IpContextReturnstrueif the underlying network channel accepted an incoming connection.
-
isSecure
public boolean isSecure()
Description copied from interface:IpContextReturnstrueif the underlying network transport is encrypted.
-
securityProtocol
public String securityProtocol()
Description copied from interface:IpContextReturns the name of the transport-layer security protocol used by the underlying network connection. Returnsnullif the underlying network channel is not currently connected, or if the underlying network connection is not secure.- Specified by:
securityProtocolin interfaceIpContext
-
cipherSuite
public String cipherSuite()
Description copied from interface:IpContextReturns the cryptographic cipher suite used by the underlying network connection. Returnsnullif the underlying network channel is not currently connected, or if the underlying network connection is not secure.- Specified by:
cipherSuitein interfaceIpContext
-
localAddress
public InetSocketAddress localAddress()
Description copied from interface:IpContextReturns the IP address and port of the local endpoint of the underlying network connection. Returnsnullif the underlying network channel is not currently connected.- Specified by:
localAddressin interfaceIpContext
-
localPrincipal
public Principal localPrincipal()
Description copied from interface:IpContextReturns the authenticated identity of the local endpoint of the underlying network connection. Returnsnullif the underlying network channel is not currently connected, or if the underlying network connection is not authenticated.- Specified by:
localPrincipalin interfaceIpContext
-
localCertificates
public Collection<Certificate> localCertificates()
Description copied from interface:IpContextReturns the certificate chain used to authenticate the local endpoint of the underlying network connection. Returnsnullif the underlying network channel is not currently connected, or if the underlying network connection is not authenticated.- Specified by:
localCertificatesin interfaceIpContext
-
remoteAddress
public InetSocketAddress remoteAddress()
Description copied from interface:IpContextReturns the IP address and port of the remote endpoint of the underlying network connection. Returnsnullif the underlying network channel is not currently connected.- Specified by:
remoteAddressin interfaceIpContext
-
remotePrincipal
public Principal remotePrincipal()
Description copied from interface:IpContextReturns the authenticated identity of the remote endpoint of the underlying network connection. Returnsnullif the underlying network channel is not currently connected, or if the underlying network connection is not authenticated.- Specified by:
remotePrincipalin interfaceIpContext
-
remoteCertificates
public Collection<Certificate> remoteCertificates()
Description copied from interface:IpContextReturns the certificate chain used to authenticate the remote endpoint of the underlying network connection. Returnsnullif the underlying network channel is not currently connected, or if the underlying network connection is not authenticated.- Specified by:
remoteCertificatesin interfaceIpContext
-
flowControl
public FlowControl flowControl()
Description copied from interface:FlowContextReturns the currentFlowControlstate of the underlying network channel.- Specified by:
flowControlin interfaceFlowContext
-
flowControl
public void flowControl(FlowControl flowControl)
Description copied from interface:FlowContextEnqueues an atomic replacement of the underlying network channel's flow control state with a newflowControl.- Specified by:
flowControlin interfaceFlowContext
-
flowControl
public FlowControl flowControl(FlowModifier flowModifier)
Description copied from interface:FlowContextEnqueues an atomic modification to the underlying network channel's flow control state by applying aflowModifierdelta.- Specified by:
flowControlin interfaceFlowContext
-
warpSettings
public WarpSettings warpSettings()
- Specified by:
warpSettingsin interfaceWarpSocketContext
-
feed
public void feed(PullRequest<Envelope> pullRequest)
- Specified by:
feedin interfaceWarpSocketContext
-
feed
public void feed(Envelope envelope, float prio)
- Specified by:
feedin interfaceWarpSocketContext
-
feed
public void feed(Envelope envelope)
- Specified by:
feedin interfaceWarpSocketContext
-
push
public void push(Envelope envelope)
- Specified by:
pushin interfacePullContext<Envelope>
-
skip
public void skip()
- Specified by:
skipin interfacePullContext<Envelope>
-
generateDemand
protected void generateDemand()
-
write
public void write(WsControl<?,? extends Envelope> frame)
- Specified by:
writein interfaceWarpSocketContext
-
become
public void become(IpSocket socket)
- Specified by:
becomein interfaceWarpSocketContext
-
close
public void close()
- Specified by:
closein interfaceWarpSocketContext
-
-