Class AbstractMediaGatewayConnection
java.lang.Object
moe.kyokobot.koe.internal.gateway.AbstractMediaGatewayConnection
- All Implemented Interfaces:
MediaGatewayConnection
- Direct Known Subclasses:
MediaGatewayV4Connection,MediaGatewayV5Connection
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 intprotected final VoiceServerInfoprotected final URI -
Constructor Summary
ConstructorsConstructorDescriptionAbstractMediaGatewayConnection(@NotNull MediaConnectionImpl connection, @NotNull VoiceServerInfo voiceServerInfo, int version) -
Method Summary
Modifier and TypeMethodDescriptionvoidprotected Collection<CodecInfo>codecs()longgetPing()@Nullable MediaValvegetValve()protected voidhandlePayload(io.netty.buffer.ByteBuf byteBuf) protected voidhandlePayload(JsonObject object) Handles the opcodes all gateway versions share, newer versions override it to handle their own opcodes first.protected Objectprotected voididentify()protected JsonObjectbooleanisOpen()protected voidprotected voidCalled right after SELECT_PROTOCOL was sent, before announcing our streams.protected voidonReady()Called after READY was dispatched, right before selecting the protocol.protected voidCalled after the connection handler got the session description.protected voidonStreamsChanged(JsonObject payload) Called with the whole VIDEO payload, before the listeners are notified.protected voidonUserDisconnected(String userId) Called before the listeners are notified.protected voidonUsersConnected(List<String> userIds) Called after the listeners were notified.voidprotected voidresume()protected JsonObjectvoidsendInternalBinPayload(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.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
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
-
version
protected final int version -
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
-
getPing
public long getPing()- Specified by:
getPingin interfaceMediaGatewayConnection
-
updateSpeaking
public void updateSpeaking(int mask) - Specified by:
updateSpeakingin interfaceMediaGatewayConnection
-
identify
protected void identify() -
identifyPayload
-
resume
protected void resume() -
resumePayload
-
heartbeatPayload
-
codecs
- Returns:
- the codecs announced when selecting the protocol
-
handlePayload
Handles the opcodes all gateway versions share, newer versions override it to handle their own opcodes first. -
handlePayload
protected void handlePayload(io.netty.buffer.ByteBuf byteBuf) -
onReady
protected void onReady()Called after READY was dispatched, right before selecting the protocol. -
onSessionDescription
Called after the connection handler got the session description. -
onStreamsChanged
Called with the whole VIDEO payload, before the listeners are notified. -
onUsersConnected
Called after the listeners were notified. -
onUserDisconnected
Called before the listeners are notified. -
onProtocolSelected
protected void onProtocolSelected()Called right after SELECT_PROTOCOL was sent, before announcing our streams. -
onClose
-
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
-