Class EngineIoServerOptions


  • public final class EngineIoServerOptions
    extends java.lang.Object
    Options for EngineIoServer
    • Field Detail

      • DEFAULT

        public static final EngineIoServerOptions DEFAULT
        The default options used by server. This instance is locked and cannot be modified. ping timeout: 5000 ping interval: 25000 allowed origins: *
      • ALLOWED_CORS_ORIGIN_ALL

        public static final java.lang.String[] ALLOWED_CORS_ORIGIN_ALL
        Specify that all origins are to be allowed for CORS
      • ALLOWED_CORS_ORIGIN_NONE

        public static final java.lang.String[] ALLOWED_CORS_ORIGIN_NONE
        Specify that no origins are allowed for CORS
      • mIsLocked

        private boolean mIsLocked
      • mCorsHandlingDisabled

        private boolean mCorsHandlingDisabled
      • mAllowSyncPolling

        private boolean mAllowSyncPolling
      • mPingInterval

        private long mPingInterval
      • mPingTimeout

        private long mPingTimeout
      • mAllowedCorsOrigins

        private java.lang.String[] mAllowedCorsOrigins
      • mInitialPacket

        private Packet<java.lang.Object> mInitialPacket
      • mMaxTimeoutThreadPoolSize

        private int mMaxTimeoutThreadPoolSize
      • mScheduledExecutorService

        private java.util.concurrent.ScheduledExecutorService mScheduledExecutorService
    • Constructor Detail

      • EngineIoServerOptions

        private EngineIoServerOptions()
    • Method Detail

      • isCorsHandlingDisabled

        public boolean isCorsHandlingDisabled()
        Gets the value of 'isCorsHandlingDisabled' option.
      • setCorsHandlingDisabled

        public EngineIoServerOptions setCorsHandlingDisabled​(boolean corsHandlingDisabled)
                                                      throws java.lang.IllegalStateException
        Sets the 'isCorsHandlingDisabled' option.
        Parameters:
        corsHandlingDisabled - Boolean value for disabling CORS handling.
        Returns:
        Instance for chaining.
        Throws:
        java.lang.IllegalStateException - If instance is locked.
      • isSyncPollingAllowed

        public boolean isSyncPollingAllowed()
        Whether sync polling transport is allowed or not. WARNING: Sync polling can cause the client to flood the server with requests.
      • setAllowSyncPolling

        public EngineIoServerOptions setAllowSyncPolling​(boolean allowSyncPolling)
        Sets whether sync polling transport is allowed or not. WARNING: Sync polling can cause the client to flood the server with requests.
      • getPingInterval

        public long getPingInterval()
        Gets the ping interval option in milliseconds.
      • setPingInterval

        public EngineIoServerOptions setPingInterval​(long pingInterval)
                                              throws java.lang.IllegalStateException
        Sets the ping interval option.
        Parameters:
        pingInterval - Ping interval in milliseconds.
        Returns:
        Instance for chaining.
        Throws:
        java.lang.IllegalStateException - If instance is locked.
      • getPingTimeout

        public long getPingTimeout()
        Gets the ping timeout option in milliseconds.
      • setPingTimeout

        public EngineIoServerOptions setPingTimeout​(long pingTimeout)
                                             throws java.lang.IllegalStateException
        Sets the ping timeout option.
        Parameters:
        pingTimeout - Ping timeout in milliseconds.
        Returns:
        Instance for chaining.
        Throws:
        java.lang.IllegalStateException - If instance is locked.
      • getAllowedCorsOrigins

        public java.lang.String[] getAllowedCorsOrigins()
        Gets the allowed CORS origins option.
      • setAllowedCorsOrigins

        public EngineIoServerOptions setAllowedCorsOrigins​(java.lang.String[] allowedCorsOrigins)
                                                    throws java.lang.IllegalStateException
        Sets the allowed CORS origins option.
        Parameters:
        allowedCorsOrigins - Array of strings containing allowed CORS origins.
        Returns:
        Instance for chaining.
        Throws:
        java.lang.IllegalStateException - If instance is locked.
      • getInitialPacket

        public Packet<?> getInitialPacket()
        Gets the initial packet option.
      • setInitialPacket

        public EngineIoServerOptions setInitialPacket​(Packet<?> initialPacket)
                                               throws java.lang.IllegalStateException,
                                                      java.lang.IllegalArgumentException
        Sets the initial packet.
        Parameters:
        initialPacket - The initial packet to send on client connection.
        Returns:
        Instance for chaining.
        Throws:
        java.lang.IllegalStateException - If instance is locked.
        java.lang.IllegalArgumentException - If initialPacket.type is not message or data is null.
      • lock

        public void lock()
        Lock this options instance to prevent modifications.
      • getMaxTimeoutThreadPoolSize

        public int getMaxTimeoutThreadPoolSize()
        Gets the max threadpool size for the ping timeout timers.
      • setMaxTimeoutThreadPoolSize

        public EngineIoServerOptions setMaxTimeoutThreadPoolSize​(int maxTimeoutThreadPoolSize)
                                                          throws java.lang.IllegalStateException
        Sets the max threadpool size for the ping timeout timers.
        Parameters:
        maxTimeoutThreadPoolSize - Max threadpool size for handling ping timeouts.
        Returns:
        Instance for chaining.
        Throws:
        java.lang.IllegalStateException - If instance is locked.
      • getScheduledExecutorService

        public java.util.concurrent.ScheduledExecutorService getScheduledExecutorService()
        Gets the custom ScheduledExecutorService for the server to use or null to let the server create it's own executor.
      • setScheduledExecutorService

        public void setScheduledExecutorService​(java.util.concurrent.ScheduledExecutorService scheduledExecutorService)
        Sets a custom ScheduledExecutorService for the server to use. This might be a good option if the application using this library already has an executor service it manages and uses. NOTE: Caller is responsible for shutting down this executor.
        Parameters:
        scheduledExecutorService - Custom ScheduledExecutorService to use for timed tasks.