public SignalServiceMessagePipe(CancellationToken token, SignalWebSocketConnection websocket, CredentialsProvider credentialsProvider)
 {
     this.Token               = token;
     this.Websocket           = websocket;
     this.CredentialsProvider = credentialsProvider;
     this.Websocket.Connect();
 }
        /// <summary>
        /// Creates an unidentified message pipe.
        ///
        /// Callers must call <see cref="SignalServiceMessagePipe.Shutdown()"/> when finished with the pipe.
        /// </summary>
        /// <returns>A SignalServiceMessagePipe for receiving Signal Service messages.</returns>
        public async Task <SignalServiceMessagePipe> CreateUnidentifiedMessagePipe(CancellationToken token, ISignalWebSocketFactory webSocketFactory)
        {
            SignalWebSocketConnection webSocket = new SignalWebSocketConnection(token, Urls.SignalServiceUrls[0].Url,
                                                                                null, UserAgent, webSocketFactory);
            var messagePipe = new SignalServiceMessagePipe(token, webSocket, CredentialsProvider, webSocketFactory);
            await messagePipe.Connect();

            return(messagePipe);
        }
Esempio n. 3
0
 internal SignalServiceMessagePipe(CancellationToken token, SignalWebSocketConnection websocket,
                                   ICredentialsProvider credentialsProvider, ISignalWebSocketFactory webSocketFactory)
 {
     Logger.LogTrace("SignalServiceMessagePipe()");
     Token                  = token;
     Websocket              = websocket;
     CredentialsProvider    = credentialsProvider;
     SignalWebSocketFactory = webSocketFactory;
 }
        /// <summary>
        /// Creates an unidentified message pipe.
        ///
        /// Callers must call <see cref="SignalServiceMessagePipe.Shutdown()"/> when finished with the pipe.
        /// </summary>
        /// <returns>A SignalServiceMessagePipe for receiving Signal Service messages.</returns>
        public async Task <SignalServiceMessagePipe> CreateUnidentifiedMessagePipeAsync(ISignalWebSocketFactory webSocketFactory, CancellationToken?token = null)
        {
            if (token == null)
            {
                token = CancellationToken.None;
            }

            SignalWebSocketConnection webSocket = new SignalWebSocketConnection(urls.SignalServiceUrls[0].Url,
                                                                                null, userAgent, webSocketFactory, token);
            var messagePipe = new SignalServiceMessagePipe(webSocket, credentialsProvider, webSocketFactory, token);
            await messagePipe.Connect();

            return(messagePipe);
        }
Esempio n. 5
0
        internal SignalServiceMessagePipe(SignalWebSocketConnection websocket,
                                          ICredentialsProvider?credentialsProvider, ISignalWebSocketFactory webSocketFactory, CancellationToken?token = null)
        {
            if (token == null)
            {
                token = CancellationToken.None;
            }

            logger.LogTrace("SignalServiceMessagePipe()");
            this.token               = token.Value;
            this.websocket           = websocket;
            this.credentialsProvider = credentialsProvider;
            signalWebSocketFactory   = webSocketFactory;
        }
 /// <summary>
 /// Creates a pipe for receiving SignalService messages.
 ///
 /// Callers must call <see cref="SignalServiceMessagePipe.Shutdown()"/> when finished with the pipe.
 /// </summary>
 /// <returns>A SignalServiceMessagePipe for receiving Signal Service messages.</returns>
 public SignalServiceMessagePipe createMessagePipe()
 {
     SignalWebSocketConnection webSocket = new SignalWebSocketConnection(Token, urls[0].getUrl(), credentialsProvider, userAgent);
     return new SignalServiceMessagePipe(Token, webSocket, credentialsProvider);
 }