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 Details

    • connection

      protected final MediaConnectionImpl connection
    • voiceServerInfo

      protected final VoiceServerInfo voiceServerInfo
    • websocketURI

      protected final URI 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

      protected CompletableFuture<Void> 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 MediaConnectionImpl connection, @NotNull VoiceServerInfo voiceServerInfo, int version)
  • Method Details

    • getValve

      @Nullable public MediaValve getValve()
      Specified by:
      getValve in interface MediaGatewayConnection
      Returns:
      The MediaValve used by this connection, or null if this gateway version does not support it.
    • start

      public CompletableFuture<Void> start()
      Specified by:
      start in interface MediaGatewayConnection
    • close

      public void close(int code, @Nullable String reason)
      Specified by:
      close in interface MediaGatewayConnection
    • reconnect

      public void reconnect()
      Specified by:
      reconnect in interface MediaGatewayConnection
    • isOpen

      public boolean isOpen()
      Specified by:
      isOpen in interface MediaGatewayConnection
    • identify

      protected abstract void identify()
    • resume

      protected abstract void resume()
    • handlePayload

      protected abstract void handlePayload(JsonObject object)
    • handlePayload

      protected abstract void handlePayload(io.netty.buffer.ByteBuf byteBuf)
    • onClose

      protected void onClose(int code, @Nullable String reason, boolean remote)
    • updateSpeaking

      public abstract void updateSpeaking(int mask)
      Specified by:
      updateSpeaking in interface MediaGatewayConnection
    • sendInternalPayload

      public void sendInternalPayload(int op, Object d)
    • sendInternalBinPayload

      public void sendInternalBinPayload(int op, byte[] d)
    • sendRaw

      protected void sendRaw(JsonObject object)
    • sendRawBin

      protected void sendRawBin(io.netty.buffer.ByteBuf buffer)
    • stripPort80

      protected static String stripPort80(String endpoint)