public SessionWS(int objectId, bool isPolling, bool forced, SessionListener handler, SubscriptionsListener subscriptions, MessagesListener messages, Session originalSession, SessionThread thread, Protocol protocol, InternalConnectionDetails details, InternalConnectionOptions options, int callerPhase, bool retryAgainIfStreamFails, bool sessionRecovery) : base(objectId, isPolling, forced, handler, subscriptions, messages, originalSession, thread, protocol, details, options, callerPhase, retryAgainIfStreamFails, sessionRecovery)
 {
     if (!InstanceFieldsInitialized)
     {
         InitializeInstanceFields();
         InstanceFieldsInitialized = true;
     }
     this.earlyOpen = options.EarlyWSOpenEnabled && !WebSocket.Disabled;
 }
 // only for test
 public SessionManager(InternalConnectionOptions options, InternalConnectionDetails details, SessionsListener listener, SubscriptionsListener subscriptions, MessagesListener messages, SessionThread thread) : this(options, details, thread)
 {
     this.subscriptions = subscriptions;
     this.messages      = messages;
     this.listener      = listener;
 }
Esempio n. 3
0
 public SessionHTTP(int objectId, bool isPolling, bool forced, SessionListener handler, SubscriptionsListener subscriptions, MessagesListener messages, Session originalSession, SessionThread thread, Protocol protocol, InternalConnectionDetails details, InternalConnectionOptions options, int callerPhase, bool retryAgainIfStreamFails, bool sessionRecovery) : base(objectId, isPolling, forced, handler, subscriptions, messages, originalSession, thread, protocol, details, options, callerPhase, retryAgainIfStreamFails, sessionRecovery)
 {
 }
 public SessionManager(InternalConnectionOptions options, InternalConnectionDetails details, SessionThread thread)
 {
     this.options = options;
     this.details = details;
     this.thread  = thread;
 }
        protected internal virtual Session createNewSession(bool isPolling, bool isComboForced, bool isHTTP, Session prevSession, SessionListener listener, SubscriptionsListener subscriptions, MessagesListener messages, SessionThread sessionThread, InternalConnectionDetails details, InternalConnectionOptions options, int handlerPhase, bool retryAgainIfStreamFails, bool sessionRecovery)
        {
            Interlocked.Increment(ref objectIdGenerator);
            int objectId = objectIdGenerator;

            HttpProvider httpProvider = TransportFactory <HttpProvider> .DefaultHttpFactory.getInstance(sessionThread);

            /*var htf = new NettyHttpProviderFactory();
             *
             * if (htf is null)
             * {
             *  log.Debug("NettyHttpProviderFactory error.");
             * }
             *
             * HttpProvider httpProvider = htf.getInstance(sessionThread);*/

            Http httpTransport = new Http(sessionThread, httpProvider);

            if (isHTTP)
            {
                Protocol    txt         = new TextProtocolHttp(objectId, sessionThread, options, httpTransport);
                SessionHTTP sessionHTTP = new SessionHTTP(objectId, isPolling, isComboForced, listener, subscriptions, messages, prevSession, sessionThread, txt, details, options, handlerPhase, retryAgainIfStreamFails, sessionRecovery);
                return(sessionHTTP);
            }
            else
            {
                Protocol ws;
                try
                {
                    ws = new TextProtocolWS(objectId, sessionThread, options, details, httpTransport);
                }
                catch (Exception e)
                {
                    log.Error("Error TextProtocolWS: " + e.Message + ", " + e.StackTrace);

                    ws = null;
                }

                return(new SessionWS(objectId, isPolling, isComboForced, listener, subscriptions, messages, prevSession, sessionThread, ws, details, options, handlerPhase, retryAgainIfStreamFails, sessionRecovery));
            }
        }