Class AbstractMediaGatewayConnection
java.lang.Object
moe.kyokobot.koe.internal.gateway.AbstractMediaGatewayConnection
- All Implemented Interfaces:
MediaGatewayConnection
- Direct Known Subclasses:
MediaGatewayV4Connection,MediaGatewayV5Connection,MediaGatewayV8Connection
public abstract class AbstractMediaGatewayConnection
extends Object
implements MediaGatewayConnection
-
Field Summary
FieldsModifier and TypeFieldDescriptionprotected final io.netty.buffer.ByteBufAllocatorprotected final io.netty.bootstrap.Bootstrapprotected io.netty.channel.Channelprotected intprotected final CompletableFuture<Void>protected final MediaConnectionImplprotected io.netty.util.concurrent.EventExecutorprotected booleanprotected final io.netty.handler.ssl.SslContextprotected final VoiceServerInfoprotected final URI -
Constructor Summary
ConstructorsConstructorDescriptionAbstractMediaGatewayConnection(@NotNull MediaConnectionImpl connection, @NotNull VoiceServerInfo voiceServerInfo, int version) -
Method Summary
Modifier and TypeMethodDescriptionvoid@Nullable MediaValvegetValve()protected abstract voidhandlePayload(io.netty.buffer.ByteBuf byteBuf) protected abstract voidhandlePayload(JsonObject object) protected abstract voididentify()booleanisOpen()protected voidvoidprotected abstract voidresume()voidsendInternalBinPayload(int op, byte[] d) voidsendInternalPayload(int op, Object d) protected voidsendRaw(JsonObject object) protected voidsendRawBin(io.netty.buffer.ByteBuf buffer) start()protected static StringstripPort80(String endpoint) protected static StringstripScheme(String endpoint) Strips the scheme from endpoints passed as a URL (e.g.abstract voidupdateSpeaking(int mask) Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitMethods inherited from interface moe.kyokobot.koe.gateway.MediaGatewayConnection
getPing, sendMLSCommitWelcome, sendMLSInvalidCommitWelcome, sendMLSKeyPackage, sendSecureFramesReadyForTransition
-
Field Details
-
connection
-
voiceServerInfo
-
websocketURI
-
bootstrap
protected final io.netty.bootstrap.Bootstrap bootstrap -
sslContext
protected final io.netty.handler.ssl.SslContext sslContext -
allocator
protected final io.netty.buffer.ByteBufAllocator allocator -
connectFuture
-
eventExecutor
protected io.netty.util.concurrent.EventExecutor eventExecutor -
channel
protected io.netty.channel.Channel channel -
connectAttempt
protected int connectAttempt -
resumable
protected boolean resumable
-
-
Constructor Details
-
AbstractMediaGatewayConnection
public AbstractMediaGatewayConnection(@NotNull @NotNull MediaConnectionImpl connection, @NotNull @NotNull VoiceServerInfo voiceServerInfo, int version)
-
-
Method Details
-
getValve
- Specified by:
getValvein interfaceMediaGatewayConnection- Returns:
- The
MediaValveused by this connection, or null if this gateway version does not support it.
-
start
- Specified by:
startin interfaceMediaGatewayConnection
-
close
- Specified by:
closein interfaceMediaGatewayConnection
-
reconnect
public void reconnect()- Specified by:
reconnectin interfaceMediaGatewayConnection
-
isOpen
public boolean isOpen()- Specified by:
isOpenin interfaceMediaGatewayConnection
-
identify
protected abstract void identify() -
resume
protected abstract void resume() -
handlePayload
-
handlePayload
protected abstract void handlePayload(io.netty.buffer.ByteBuf byteBuf) -
onClose
-
updateSpeaking
public abstract void updateSpeaking(int mask) - Specified by:
updateSpeakingin interfaceMediaGatewayConnection
-
sendInternalPayload
-
sendInternalBinPayload
public void sendInternalBinPayload(int op, byte[] d) -
sendRaw
-
sendRawBin
protected void sendRawBin(io.netty.buffer.ByteBuf buffer) -
stripScheme
Strips the scheme from endpoints passed as a URL (e.g. "wss://host:443") instead of "host:port". -
stripPort80
-