コード例 #1
0
        /// <summary>
        /// Connect to the STOMP 1.2 service.
        /// </summary>
        /// <param name="extraHeaders">Non-standard headers to include in the connect request frame.</param>
        /// <param name="cancellationToken">The token to monitor for cancellation requests.</param>
        /// <returns>A task representing the connect operation.</returns>
        public async Task <IStompConnection> ConnectAsync(
            IEnumerable <KeyValuePair <string, string> > extraHeaders = null,
            CancellationToken?cancellationToken = null)
        {
            _client.Start(_cts.Token);

            await _client.WriteConnectAsync(_host, _user, _password, Heartbeat.NoHeartbeat, extraHeaders, cancellationToken);

            return(new StompConnection(_client));
        }