Class AbstractNetherNetXboxSignaling
java.lang.Object
io.netty.channel.ChannelHandlerAdapter
io.netty.channel.ChannelInboundHandlerAdapter
io.netty.channel.SimpleChannelInboundHandler<io.netty.handler.codec.http.websocketx.TextWebSocketFrame>
org.cloudburstmc.netty.channel.nethernet.signaling.AbstractNetherNetXboxSignaling
- All Implemented Interfaces:
io.netty.channel.ChannelHandler,io.netty.channel.ChannelInboundHandler,AutoCloseable,NetherNetClientSignaling,NetherNetServerSignaling,NetherNetSignaling
- Direct Known Subclasses:
NetherNetXboxRpcSignaling,NetherNetXboxSignaling
public abstract class AbstractNetherNetXboxSignaling
extends io.netty.channel.SimpleChannelInboundHandler<io.netty.handler.codec.http.websocketx.TextWebSocketFrame>
implements NetherNetClientSignaling, NetherNetServerSignaling
-
Nested Class Summary
Nested classes/interfaces inherited from interface io.netty.channel.ChannelHandler
io.netty.channel.ChannelHandler.SharableNested classes/interfaces inherited from interface org.cloudburstmc.netty.channel.nethernet.signaling.NetherNetClientSignaling
NetherNetClientSignaling.NotFoundHandlerNested classes/interfaces inherited from interface org.cloudburstmc.netty.channel.nethernet.signaling.NetherNetServerSignaling
NetherNetServerSignaling.NewConnectionHandler, NetherNetServerSignaling.PongDataNested classes/interfaces inherited from interface org.cloudburstmc.netty.channel.nethernet.signaling.NetherNetSignaling
NetherNetSignaling.IceServerInfo, NetherNetSignaling.SignalHandler -
Field Summary
FieldsModifier and TypeFieldDescriptionprotected io.netty.channel.Channelprotected CompletableFuture<List<NetherNetSignaling.IceServerInfo>>protected final io.netty.channel.EventLoopGroupprotected final Map<Long,NetherNetSignaling.SignalHandler> protected List<NetherNetSignaling.IceServerInfo>protected final Stringprotected final io.netty.util.internal.logging.InternalLoggerprotected NetherNetClientSignaling.NotFoundHandlerprotected final URIprotected final String -
Constructor Summary
ConstructorsModifierConstructorDescriptionprotectedAbstractNetherNetXboxSignaling(String localNetworkId, String xboxToken, URI uri) -
Method Summary
Modifier and TypeMethodDescriptionvoidbind(SocketAddress localAddress, io.netty.channel.EventLoop eventLoop) Binds the signaling medium to listen for incoming connections (Server mode).voidchannelInactive(io.netty.channel.ChannelHandlerContext ctx) voidclose()Closes the signaling channel and releases any associated resources.connect(SocketAddress remoteAddress) Connects to the signaling medium (Client mode).protected CompletableFuture<List<NetherNetSignaling.IceServerInfo>>protected voiddispatchSignalToPipeline(String sender, String rawMsg) voidexceptionCaught(io.netty.channel.ChannelHandlerContext ctx, Throwable cause) Returns the ICE servers (STUN/TURN) obtained from the signaling handshake.Returns the Local Network ID of this client as a String.booleanisActive()Whether the signaling is connected and able to carry messagesprotected abstract voidonConnected(io.netty.channel.ChannelHandlerContext ctx) Called when the WebSocket handshake is complete.protected @Nullable NetherNetSignaling.IceServerInfoparseTurnServer(com.google.gson.JsonElement el) protected List<NetherNetSignaling.IceServerInfo>parseTurnServers(com.google.gson.JsonObject json) voidremoveSignalHandler(long connectionId) Removes the signaling handler for a specific connection ID.voidSets the advertisement data for the discovery mechanism (e.g.voidHandler for new connections.voidSets a handler to be called when a signaling message is received for an unknown connection ID.voidsetSignalHandler(long connectionId, NetherNetSignaling.SignalHandler handler) Sets a handler to receive signaling messages for a specific connection ID.voiduserEventTriggered(io.netty.channel.ChannelHandlerContext ctx, Object evt) Methods inherited from class io.netty.channel.SimpleChannelInboundHandler
acceptInboundMessage, channelRead, channelRead0Methods inherited from class io.netty.channel.ChannelInboundHandlerAdapter
channelActive, channelReadComplete, channelRegistered, channelUnregistered, channelWritabilityChangedMethods inherited from class io.netty.channel.ChannelHandlerAdapter
ensureNotSharable, handlerAdded, handlerRemoved, isSharableMethods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitMethods inherited from interface io.netty.channel.ChannelHandler
handlerAdded, handlerRemovedMethods inherited from interface org.cloudburstmc.netty.channel.nethernet.signaling.NetherNetServerSignaling
allowsIceOnLocalPort, serverIdentity, setMetrics, usesTrickleIceMethods inherited from interface org.cloudburstmc.netty.channel.nethernet.signaling.NetherNetSignaling
sendFullSdp, sendSignal
-
Field Details
-
log
protected final io.netty.util.internal.logging.InternalLogger log -
xboxToken
-
localNetworkId
-
uri
-
eventLoopGroup
protected final io.netty.channel.EventLoopGroup eventLoopGroup -
channel
protected io.netty.channel.Channel channel -
connectFuture
-
iceServers
-
handlers
-
newConnectionHandler
-
notFoundHandler
-
-
Constructor Details
-
AbstractNetherNetXboxSignaling
-
-
Method Details
-
getLocalNetworkId
Description copied from interface:NetherNetSignalingReturns the Local Network ID of this client as a String. This is required for formatting the 'candidate:' string in SDP.- Specified by:
getLocalNetworkIdin interfaceNetherNetSignaling
-
connect
public CompletableFuture<List<NetherNetSignaling.IceServerInfo>> connect(SocketAddress remoteAddress) Description copied from interface:NetherNetClientSignalingConnects to the signaling medium (Client mode).- Specified by:
connectin interfaceNetherNetClientSignaling- Parameters:
remoteAddress- The address of the signaling server to connect to.
-
bind
public void bind(SocketAddress localAddress, io.netty.channel.EventLoop eventLoop) throws ConnectException Description copied from interface:NetherNetServerSignalingBinds the signaling medium to listen for incoming connections (Server mode).- Specified by:
bindin interfaceNetherNetServerSignaling- Parameters:
localAddress- The local address to bind to.eventLoop- The owning channel's event loop.- Throws:
ConnectException
-
connectInternal
-
userEventTriggered
public void userEventTriggered(io.netty.channel.ChannelHandlerContext ctx, Object evt) throws Exception - Specified by:
userEventTriggeredin interfaceio.netty.channel.ChannelInboundHandler- Overrides:
userEventTriggeredin classio.netty.channel.ChannelInboundHandlerAdapter- Throws:
Exception
-
onConnected
protected abstract void onConnected(io.netty.channel.ChannelHandlerContext ctx) Called when the WebSocket handshake is complete. -
getIceServers
Description copied from interface:NetherNetServerSignalingReturns the ICE servers (STUN/TURN) obtained from the signaling handshake. Returns empty list if none available or not applicable.- Specified by:
getIceServersin interfaceNetherNetServerSignaling
-
setNewConnectionHandler
Description copied from interface:NetherNetServerSignalingHandler for new connections.- Specified by:
setNewConnectionHandlerin interfaceNetherNetServerSignaling- Parameters:
handler- Functional interface receiving (ConnectionID, RemoteNetworkID, Payload)
-
setNotFoundHandler
Description copied from interface:NetherNetClientSignalingSets a handler to be called when a signaling message is received for an unknown connection ID.- Specified by:
setNotFoundHandlerin interfaceNetherNetClientSignaling- Parameters:
handler- The handler to process incoming signaling messages for unknown connection IDs.
-
setSignalHandler
Description copied from interface:NetherNetSignalingSets a handler to receive signaling messages for a specific connection ID.- Specified by:
setSignalHandlerin interfaceNetherNetSignaling- Parameters:
connectionId- The connection ID to listen for.handler- The handler to process incoming signaling messages.
-
removeSignalHandler
public void removeSignalHandler(long connectionId) Description copied from interface:NetherNetSignalingRemoves the signaling handler for a specific connection ID.- Specified by:
removeSignalHandlerin interfaceNetherNetSignaling- Parameters:
connectionId- The connection ID whose handler should be removed.
-
setAdvertisementData
Description copied from interface:NetherNetServerSignalingSets the advertisement data for the discovery mechanism (e.g. LAN Pong).- Specified by:
setAdvertisementDatain interfaceNetherNetServerSignaling- Parameters:
pongData- The Pong advertisement data.
-
exceptionCaught
public void exceptionCaught(io.netty.channel.ChannelHandlerContext ctx, Throwable cause) throws Exception - Specified by:
exceptionCaughtin interfaceio.netty.channel.ChannelHandler- Specified by:
exceptionCaughtin interfaceio.netty.channel.ChannelInboundHandler- Overrides:
exceptionCaughtin classio.netty.channel.ChannelInboundHandlerAdapter- Throws:
Exception
-
channelInactive
- Specified by:
channelInactivein interfaceio.netty.channel.ChannelInboundHandler- Overrides:
channelInactivein classio.netty.channel.ChannelInboundHandlerAdapter- Throws:
Exception
-
isActive
public boolean isActive()Description copied from interface:NetherNetSignalingWhether the signaling is connected and able to carry messages- Specified by:
isActivein interfaceNetherNetSignaling
-
close
public void close()Description copied from interface:NetherNetSignalingCloses the signaling channel and releases any associated resources.- Specified by:
closein interfaceAutoCloseable- Specified by:
closein interfaceNetherNetSignaling
-
dispatchSignalToPipeline
-
parseTurnServers
-
parseTurnServer
protected @Nullable NetherNetSignaling.IceServerInfo parseTurnServer(com.google.gson.JsonElement el)
-