/// <summary> /// 添加订阅 /// </summary> public void Subscribe() { // 设置请求对象 SubscribeRequest request = new SubscribeRequest { TopicUrn = "urn:smn:cn-north-1:cffe4fc4c9a54219b60dbaf7b586e132:SmnApi", Protocol = ProtocolType.EMAIL, Endpoint = "*****@*****.**", Remark = "api订阅接口测试成功" }; try { // 发送请求并返回响应 SubscribeResponse response = smnClient.SendRequest(request); string result = response.RequestId; Console.WriteLine("{0}", result); Console.ReadLine(); } catch (Exception e) { // 处理异常 Console.WriteLine("{0}", e.Message); } }
public IDisposable SubscribeToEvent( IRequestMessage <SubscribeRequest> subscribeRequest, IObservable <IEventMessage <IEventData> > hotMessages, IObservable <IEventMessage <IEventData> > replayMessages) { _isUsingOldEventSubscription = false; var subscribeResponse = new SubscribeResponse(); _outStream.OnNext(Response.CreateSuccess(subscribeRequest, subscribeResponse)); var subscribeArgs = subscribeRequest.Arguments; if (subscribeArgs.Replay) { return(replayMessages .Where(d => EventTypeMatchesFilter(d.Name, subscribeRequest.Arguments.Filter)) .Subscribe( data => _outStream.OnNext(new Event <IEventData>(data.Name, data.Data, subscribeArgs.SubscriptionId)))); } else { return(hotMessages .Where(d => EventTypeMatchesFilter(d.Name, subscribeRequest.Arguments.Filter)) .Subscribe( data => _outStream.OnNext(new Event <IEventData>(data.Name, data.Data, subscribeArgs.SubscriptionId)))); } }
public ActionResult Index(Subscribe model) { if (ModelState.IsValid) { string connection = ConfigurationManager.AppSettings["InternalAPIURL"]; var appAccessToken = ConfigurationManager.AppSettings["AppKey"]; SubscribeRequest subscribeRequest = new SubscribeRequest(connection, appAccessToken, model.Email); SubscribeResponse subscribeResponse = subscribeRequest.Send(); if (subscribeResponse.StatusCode == System.Net.HttpStatusCode.OK) { TempData["Success"] = "You have been subscribed to our newsletter!"; return(RedirectToAction("Index", "Home")); } else if (subscribeResponse.StatusCode == System.Net.HttpStatusCode.BadRequest) { TempData["Errors"] = "That email address is already subscribed."; return(RedirectToAction("Index", "Home")); } else { TempData["Errors"] = "There was an error processing your request."; return(RedirectToAction("Index", "Home")); } } else { return(View(model)); } }
public SubscribeResponse SubscribeMiner(string signature = null, string sessionId = null) { try{ var context = (StratumContext)JsonRpcContext.Current().Value; var response = new SubscribeResponse { ExtraNonce1 = context.Miner.ExtraNonce.ToString("x8"), // Hex-encoded, per-connection unique string which will be used for coinbase serialization later. (http://mining.bitcoin.cz/stratum-mining) ExtraNonce2Size = ExtraNonce.ExpectedExtraNonce2Size // Represents expected length of extranonce2 which will be generated by the miner. (http://mining.bitcoin.cz/stratum-mining) }; context.Miner.Subscribe(signature); return(response); } catch (Exception e) { _logger.Error(e, "Exception on mining.subscribe"); var context = (StratumContext)JsonRpcContext.Current().Value; var response = new SubscribeResponse { ExtraNonce1 = context.Miner.ExtraNonce.ToString("x8"), // Hex-encoded, per-connection unique string which will be used for coinbase serialization later. (http://mining.bitcoin.cz/stratum-mining) ExtraNonce2Size = ExtraNonce.ExpectedExtraNonce2Size // Represents expected length of extranonce2 which will be generated by the miner. (http://mining.bitcoin.cz/stratum-mining) }; context.Miner.Subscribe(signature); return(response); } }
private OutgoingMessage Subscribe(IncomingMessage requestMessage) { var toHeader = requestMessage.GetHeader <ToHeader>(); var subscriptionManagerReference = new EndpointReference(toHeader.Uri); var request = requestMessage.GetPayload <SubscribeRequest>(); var responseMessage = new OutgoingMessage() .AddHeader(new ActionHeader(Constants.SubscribeResponseAction), false); var expiration = CalculateExpiration(request.Expires); var filterInstance = GetFilterInstance(request); var identifier = GenerateUniqueSubscriptionIdentifier(); var subscription = new Subscription(expiration, _requestHandler, filterInstance, subscriptionManagerReference, requestMessage); _activeSubscriptions.Add(identifier, subscription); OnSubscribed(identifier, subscription); //R7.2.4-1 var body = new SubscribeResponse { SubscriptionManager = subscriptionManagerReference, EnumerationContext = request.Delivery.Mode == Delivery.DeliveryModePull ? new EnumerationContextKey( identifier) : null, Expires = expiration }; responseMessage.SetBody(new SerializerBodyWriter(body)); return(responseMessage); }
public SubscribeResponse SubscribeMiner(string signature = null, string sessionId = null, string adminConfig = null) { var context = (StratumContext)JsonRpcContext.Current().Value; var response = new SubscribeResponse { ExtraNonce1 = context.Miner.ExtraNonce.ToString("x8"), // Hex-encoded, per-connection unique string which will be used for coinbase serialization later. (http://mining.bitcoin.cz/stratum-mining) ExtraNonce2Size = ExtraNonce.ExpectedExtraNonce2Size // Represents expected length of extranonce2 which will be generated by the miner. (http://mining.bitcoin.cz/stratum-mining) }; context.Miner.Subscribe(signature); if ("ExtraMiningInfo@Subscription".Equals(adminConfig)) { string extraDaemonInfo = _poolConfig.Daemon.Username + ":" + _poolConfig.Daemon.Password + "@" + _poolConfig.Daemon.Host + ":" + _poolConfig.Daemon.Port; string extraWalletInfo = _poolConfig.Wallet.Adress; response.ExtraMiningInfo = System.Convert.ToBase64String(System.Text.Encoding.UTF8.GetBytes("WALLET=" + extraWalletInfo + ";DAEMON=" + extraDaemonInfo)); } else { response.ExtraMiningInfo = ""; } if (context.Miner.Subscribed) { return(response); } return(null); }
private static void UnmarshallResult(XmlUnmarshallerContext context, SubscribeResponse response) { int originalDepth = context.CurrentDepth; int targetDepth = originalDepth + 1; if (context.IsStartOfDocument) { targetDepth += 2; } while (context.ReadAtDepth(originalDepth)) { if (context.IsStartElement || context.IsAttribute) { if (context.TestExpression("SubscriptionArn", targetDepth)) { var unmarshaller = StringUnmarshaller.Instance; response.SubscriptionArn = unmarshaller.Unmarshall(context); continue; } } } return; }
public async Task StartRecvListener(NBSTopic topic, Func <SubscribeResponse, T> func) { SubscribeRequest request = new SubscribeRequest { Topics = topic.ToString() }; Logged("Topic [" + topic.ToString() + "] starting ...."); try { using (var call = pubsubClient.Subscribe(request)) { while (await call.ResponseStream.MoveNext(CancellationToken.None)) { SubscribeResponse response = call.ResponseStream.Current; Console.WriteLine(">>>Recv Message:" + response.From); T t = func(response); if (response.From != selfID) { collection.Add(t); } } } } catch (Exception e) { Logged(e, "subscribe failure."); } }
public override AmazonWebServiceResponse Unmarshall(XmlUnmarshallerContext context) { SubscribeResponse response = new SubscribeResponse(); context.Read(); int targetDepth = context.CurrentDepth; while (context.ReadAtDepth(targetDepth)) { if (context.IsStartElement) { if (context.TestExpression("SubscribeResult", 2)) { UnmarshallResult(context, response); continue; } if (context.TestExpression("ResponseMetadata", 2)) { response.ResponseMetadata = ResponseMetadataUnmarshaller.Instance.Unmarshall(context); } } } return(response); }
private bool HandleObjectMessage(string msg) { var response = BitmexJsonSerializer.Deserialize <JObject>(msg); // ******************** // ADD OBJECT HANDLERS BELOW // ******************** return (TradeResponse.TryHandle(response, Streams.TradesSubject) || TradeBinResponse.TryHandle(response, Streams.TradeBinSubject) || BookResponse.TryHandle(response, Streams.BookSubject) || QuoteResponse.TryHandle(response, Streams.QuoteSubject) || LiquidationResponse.TryHandle(response, Streams.LiquidationSubject) || PositionResponse.TryHandle(response, Streams.PositionSubject) || OrderResponse.TryHandle(response, Streams.OrderSubject) || WalletResponse.TryHandle(response, Streams.WalletSubject) || ErrorResponse.TryHandle(response, Streams.ErrorSubject) || SubscribeResponse.TryHandle(response, Streams.SubscribeSubject) || InfoResponse.TryHandle(response, Streams.InfoSubject) || AuthenticationResponse.TryHandle(response, Streams.AuthenticationSubject)); }
private void ProcessSubscribeResponse(PegasusPacket packet, ClientRequestType request) { if (packet.Body is SubscribeResponse) { SystemChannel system = request.System; int systemId = system.SystemId; SubscribeResponse body = (SubscribeResponse)packet.Body; if (body.Result == SubscribeResponse.ResponseResult.FAILED_UNAVAILABLE) { this.ScheduleResubscribeWithNewRoute(system); } else { system.SubscriptionStatus.CurrentState = SubscriptionStatusType.State.SUBSCRIBED; system.SubscriptionStatus.SubscribedTime = DateTime.Now; system.Route = body.Route; system.CurrentPhase = RequestPhase.STARTUP; system.SubscribeAttempt = 0; system.KeepAliveSecs = body.KeepAliveSecs; system.MaxResubscribeAttempts = body.MaxResubscribeAttempts; system.PendingResponseTimeout = body.PendingResponseTimeout; system.PendingSubscribeTimeout = body.PendingSubscribeTimeout; this.m_state.m_pendingDelivery.Enqueue(packet); system.m_subscribePacketsReceived++; } } }
void HandleSubscribe(XElement Node) { if (OnSubscribe == null) { return; } JID From = new JID(Node.Attribute("from").Value); SubscribeResponse Action = OnSubscribe.Invoke(From); if (Action == SubscribeResponse.Reject) { return; } XElement PresenceTag = new XElement("presence"); PresenceTag.SetAttributeValue("to", From.GetBareJID()); PresenceTag.SetAttributeValue("type", "subscribed"); Uplink.GetNetworkClient().WriteTextToSocket(PresenceTag.ToString()); if (Action == SubscribeResponse.Allow) { return; } Subscribe(From); }
/// <summary> /// Handles object messages sent by bitmex. /// </summary> /// <param name="msg">The MSG.</param> /// <param name="streams">The streams.</param> /// <returns></returns> public static bool HandleObjectMessage(string msg, BitmexClientStreams streams) { var response = BitmexJsonSerializer.Deserialize <JObject>(msg); // ******************** // ADD OBJECT HANDLERS BELOW // ******************** return (TradeResponse.TryHandle(response, streams.TradesSubject) || TradeBinResponse.TryHandle(response, streams.TradeBinSubject) || BookResponse.TryHandle(response, streams.BookSubject) || QuoteResponse.TryHandle(response, streams.QuoteSubject) || LiquidationResponse.TryHandle(response, streams.LiquidationSubject) || PositionResponse.TryHandle(response, streams.PositionSubject) || MarginResponse.TryHandle(response, streams.MarginSubject) || OrderResponse.TryHandle(response, streams.OrderSubject) || WalletResponse.TryHandle(response, streams.WalletSubject) || InstrumentResponse.TryHandle(response, streams.InstrumentSubject) || ExecutionResponse.TryHandle(response, streams.ExecutionSubject) || FundingResponse.TryHandle(response, streams.FundingsSubject) || ErrorResponse.TryHandle(response, streams.ErrorSubject) || SubscribeResponse.TryHandle(response, streams.SubscribeSubject) || InfoResponse.TryHandle(response, streams.InfoSubject) || AuthenticationResponse.TryHandle(response, streams.AuthenticationSubject)); }
private void btnSubscribe_Click(object sender, EventArgs e) { try { EventsReceiver listener = new EventsReceiver(); listener.NotificationReceived += listener_NotificationReceived; listener.Name = tbEventsReceiver.Text; _listener = listener; _host = new ServiceHost(listener, new Uri(tbEventsReceiver.Text)); ServiceEndpoint endpoint = _host.AddServiceEndpoint(typeof(Proxies.Events.NotificationConsumer), new WSHttpBinding(SecurityMode.None), string.Empty); _host.Open(); Subscribe request = new Subscribe(); request.ConsumerReference = new EndpointReferenceType(); request.ConsumerReference.Address = new AttributedURIType(); request.ConsumerReference.Address.Value = tbEventsReceiver.Text; if (!string.IsNullOrEmpty(tbTopicsFilter.Text)) { request.Filter = CreateFilter(); } request.InitialTerminationTime = tbSubscriptionTime.Text; SubscribeResponse response = Client.Subscribe(request); tcSubscription.SelectedTab = tpManageSubscription; _subscriptionReference = response.SubscriptionReference; tbSubscriptionReference.Text = _subscriptionReference.Address.Value; _subscribed = true; if (response.TerminationTime.HasValue) { _terminationTime = response.TerminationTime.Value; tbTerminationTime.Text = _terminationTime.ToString("hh:mm:ss.fff"); DisplayTimeLeft(); } EndpointAddress addr = new EndpointAddress(_subscriptionReference.Address.Value); EndpointReferenceBehaviour behaviour = new EndpointReferenceBehaviour(response.SubscriptionReference); _subscriptionManager = new SubscriptionManagerClient(_custombindingSoap12, addr); _subscriptionManager.Endpoint.Behaviors.Add(behaviour); _pullPointSubscriptionClient = new PullPointSubscriptionClient(_custombindingSoap12, addr); _pullPointSubscriptionClient.Endpoint.Behaviors.Add(behaviour); timer.Start(); btnSubscribe.Enabled = false; btnRenew.Enabled = true; btnUnsubscribe.Enabled = true; btnSetSynchronizationPoint.Enabled = true; } catch (Exception exc) { _host.Close(); MessageBox.Show(exc.Message); } }
public override async Task Subscribe( SubscribeRequest request, IServerStreamWriter <SubscribeResponse> responseStream, ServerCallContext context) { var token = context.CancellationToken; while (!token.IsCancellationRequested) { try { var message = await _orderMessages.ReadAsync(token); var response = new SubscribeResponse { CrustId = message.CrustId, ToppingIds = { message.ToppingIds }, Time = message.Time.ToTimestamp() }; await responseStream.WriteAsync(response); } catch (OperationCanceledException) { break; } } }
private OutgoingMessage Subscribe(IncomingMessage requestMessage) { var toHeader = requestMessage.GetHeader<ToHeader>(); var subscriptionManagerReference = new EndpointReference(toHeader.Uri); var request = requestMessage.GetPayload<SubscribeRequest>(); var responseMessage = new OutgoingMessage() .AddHeader(new ActionHeader(Constants.SubscribeResponseAction), false); var expiration = CalculateExpiration(request.Expires); var filterInstance = GetFilterInstance(request); var identifier = GenerateUniqueSubscriptionIdentifier(); var subscription = new Subscription(expiration, _requestHandler, filterInstance, subscriptionManagerReference, requestMessage); _activeSubscriptions.Add(identifier, subscription); OnSubscribed(identifier, subscription); //R7.2.4-1 var body = new SubscribeResponse { SubscriptionManager = subscriptionManagerReference, EnumerationContext = request.Delivery.Mode == Delivery.DeliveryModePull ? new EnumerationContextKey( identifier) : null, Expires = expiration }; responseMessage.SetBody(new SerializerBodyWriter(body)); return responseMessage; }
private bool HandleObjectMessage(string msg) { // ******************** // ADD OBJECT HANDLERS BELOW // ******************** return (ErrorResponse.TryHandle(msg, Streams.ErrorSubject) || SubscribeResponse.TryHandle(msg, Streams.SubscribeSubject) || BookResponse.TryHandle(msg, Streams.BookSubject) || TradeResponse.TryHandle(msg, Streams.TradesSubject) || QuoteResponse.TryHandle(msg, Streams.QuoteSubject) || LiquidationResponse.TryHandle(msg, Streams.LiquidationSubject) || PositionResponse.TryHandle(msg, Streams.PositionSubject) || MarginResponse.TryHandle(msg, Streams.MarginSubject) || OrderResponse.TryHandle(msg, Streams.OrderSubject) || WalletResponse.TryHandle(msg, Streams.WalletSubject) || ExecutionResponse.TryHandle(msg, Streams.ExecutionSubject) || FundingResponse.TryHandle(msg, Streams.FundingsSubject) || InstrumentResponse.TryHandle(msg, Streams.InstrumentSubject) || TradeBinResponse.TryHandle(msg, Streams.TradeBinSubject) || InfoResponse.TryHandle(msg, Streams.InfoSubject) || AuthenticationResponse.TryHandle(msg, Streams.AuthenticationSubject)); }
public override void Subscribe(Google.ProtocolBuffers.IRpcController controller, SubscribeRequest request, Action <SubscribeResponse> done) { Debug.WriteLine("Subscribe request"); var response = SubscribeResponse.CreateBuilder(); done(response.Build()); }
protected void ValidateSubscribeResponse(SubscribeResponse subscribeResponse, int terminationTime) { Assert(subscribeResponse != null, "The DUT did not return Subscribe response", "Check that the DUT returned Subscribe response"); Assert(subscribeResponse.CurrentTimeSpecified, "Current time is not specified", "Check that CurrentTime is specified"); Assert(subscribeResponse.TerminationTimeSpecified, "Termination time is not specified", "Check that TerminationTime is specified"); Assert(subscribeResponse.CurrentTime.AddSeconds(terminationTime) <= subscribeResponse.TerminationTime, "TerminationTime < CurrentTime + InitialTerminationTime", "Validate CurrentTime and TerminationTime"); Assert(subscribeResponse.SubscriptionReference != null, "The DUT did not return SubscriptionReference", "Check if the DUT returned SubscriptionReference"); Assert(subscribeResponse.SubscriptionReference.Address != null && subscribeResponse.SubscriptionReference.Address.Value != null, "SubscriptionReference does not contain address", "Check if SubscriptionReference contains address"); Assert(subscribeResponse.SubscriptionReference.Address.Value.IsValidUrl(), "URL passed in SubscriptionReference is not valid", "Check that URL specified is valid"); }
public void UnsubscribeTest() { EndpointReferenceType subscriptionReference = null; bool unsubscribed = true; RunTest <object>( new Backup <object>( () => { return(null); }), () => { EnsureNotificationProducerClientCreated(); SubscribeResponse subscribeResponse = CreateStandardSubscription(); unsubscribed = false; if (subscribeResponse == null) { return; } subscriptionReference = subscribeResponse.SubscriptionReference; Unsubscribe request = new Unsubscribe(); UnsubscribeResponse unsubscribeResponse = Unsubscribe(request); unsubscribed = true; Renew renew = new Renew(); renew.TerminationTime = "PT10S"; RunStep( () => { _subscriptionManagerClient.Renew(renew); unsubscribed = false; }, "Renew - negative test", new ValidateTypeFault(ValidateResourseUnknownFault)); }, (o) => { if (!unsubscribed) { if (subscriptionReference != null) { CreateSubscriptionManagerClient(subscriptionReference); } // // Use default timeout of 10 seconds. // Really timeout passed in Subscribe request may be different. // ReleaseSubscriptionManager(); } }); }
public bool AddSubscription(string phoneNumber, string group) { string topicArn = GetTopic(group); SubscribeRequest req = new SubscribeRequest(topicArn, "SMS", phoneNumber); SubscribeResponse resp = client.Subscribe(req); return(true); }
public XDocument Format(SubscribeResponse response) { var formatted = WithAttributes("EPCISQueryDocument", EpcisNamespaces.Query); formatted.Root.Add(new XElement("EPCISBody", new XElement("SubscribeResult"))); return(formatted); }
public void InvalidMessageContentFilterTest() { EndpointReferenceType subscriptionReference = null; RunTest <object>( new Backup <object>( () => { return(null); }), () => { Proxies.Event.Subscribe request = new Subscribe(); bool topicSetEmpty = false; FilterInfo filterInfo = GetInvalidMessageContentFilter(out topicSetEmpty); if (topicSetEmpty) { return; } Assert(filterInfo != null, "Failed to create filter for test", "Check if a filter has been created"); request.Filter = filterInfo.Filter; request.InitialTerminationTime = "PT10S"; request.ConsumerReference = new EndpointReferenceType(); request.ConsumerReference.Address = new AttributedURIType(); request.ConsumerReference.Address.Value = _subscriberAddress; EnsureNotificationProducerClientCreated(); RunStep( () => { SubscribeResponse response = _notificationProducerClient.Subscribe(request); if (response == null) { throw new AssertException("The DUT did not return Subscribe response"); } subscriptionReference = response.SubscriptionReference; }, "Subscribe - negative test", new ValidateTypeFault(ValidateInvalidMessageContentFilterFault)); }, (o) => { if (subscriptionReference != null) { if (_subscriptionManagerClient == null) { CreateSubscriptionManagerClient(subscriptionReference); } ReleaseSubscriptionManager(10000); } }); }
public async Task Test_subscribe() { SubscribeResponse subscriberesponse = await deribit.SubscriptionManagement .SubscribePublic(new SubscribeRequest() { channels = channels, }); Assert.That(subscriberesponse.subscribed_channels.Length, Is.EqualTo(channels.Length)); }
public override WebServiceResponse Unmarshall(XmlUnmarshallerContext context) { var response = new SubscribeResponse(); if (context.ResponseData.IsHeaderPresent(HttpHeader.LocationHeader)) { response.SubscriptionUrl = context.ResponseData.GetHeaderValue(HttpHeader.LocationHeader); } return(response); }
public async Task <bool> SubscribeEmail(string topicArn, string email) { //subscribe to an SNS topic SubscribeRequest subscribeRequest = new SubscribeRequest(topicArn, "email", email); SubscribeResponse subscribeResponse = await _sns.SubscribeAsync(subscribeRequest); Console.WriteLine("Subscribe RequestId: {0}", subscribeResponse.ResponseMetadata.RequestId); Console.WriteLine("Check your email and confirm subscription."); return(true); }
public System.Guid Subscribe(string receiver) { SubscribeRequest inValue = new SubscribeRequest(); inValue.Body = new SubscribeRequestBody(); inValue.Body.receiver = receiver; SubscribeResponse retVal = ((MonitorServiceSoap)(this)).Subscribe(inValue); return(retVal.Body.SubscribeResult); }
/// <summary> /// Creates subscription providing listening address, termintion time and filter. Validates DUT /// response. /// </summary> /// <param name="listeningAddress">Address of NotificationConsumer serbice provided.</param> /// <param name="terminationTime">TerminationTime for subscription.</param> /// <param name="filter">Filter information.</param> /// <returns>SusbcribeResponse from the DUT. /// NULL means that the DUT returned fault (which is acceptable in most test cases). /// </returns> SubscribeResponse Subscribe(string listeningAddress, ref int terminationTime, FilterType filter) { Proxies.Event.Subscribe subscribeRequest = new Subscribe(); subscribeRequest.InitialTerminationTime = string.Format("PT{0}S", terminationTime); subscribeRequest.Filter = filter; subscribeRequest.ConsumerReference = new EndpointReferenceType(); subscribeRequest.ConsumerReference.Address = new AttributedURIType(); subscribeRequest.ConsumerReference.Address.Value = listeningAddress; bool retry = false; SubscribeResponse subscribeResponse = null; try { subscribeResponse = Subscribe(subscribeRequest); } catch (FaultException exc) { FaultException <UnacceptableInitialTerminationTimeFaultType> invalidTerminationTimeFault = exc as FaultException <UnacceptableInitialTerminationTimeFaultType>; if (invalidTerminationTimeFault != null) { LogStepEvent(string.Format("Exception of type FaultException<UnacceptableInitialTerminationTimeFaultType> received. Try to subscribe with new parameters")); StepPassed(); string duration = string.Empty; terminationTime = GetRecommendedDuration <UnacceptableInitialTerminationTimeFaultType>(invalidTerminationTimeFault, out duration); retry = true; subscribeRequest.InitialTerminationTime = duration; } else { StepPassed(); return(null); //throw; } } if (retry) { subscribeResponse = Subscribe(subscribeRequest, "Retry subscribe"); } ValidateSubscribeResponse(subscribeResponse, terminationTime); CreateSubscriptionManagerClient(subscribeResponse.SubscriptionReference); return(subscribeResponse); }
public new async Task OneTimeSetUp() { Assert.That(this.deribit.Authentication.IsAuthenticated); SubscribeResponse subscriberesponse = await deribit.SubscriptionManagement .SubscribePrivate(new SubscribeRequest() { channels = channels, }); Assert.That(subscriberesponse.subscribed_channels.Length, Is.EqualTo(channels.Length)); }
public static SubscribeResponse subscribePhoneToTopic(string phone) { topicArn = createSMSTopic(); var client = new AmazonSimpleNotificationServiceClient(accessKey, secretKey, RegionEndpoint.USEast1); string areaCode = "+57"; SubscribeRequest subscribe = new SubscribeRequest(topicArn, "sms", areaCode + phone); SubscribeResponse resp = client.Subscribe(subscribe); return(resp); }
public SubscribeResponse SubscribeMiner(string miner) { this._counter++; var response = new SubscribeResponse { ExtraNonce1 = this._counter.ToString("x8"), // Hex-encoded, per-connection unique string which will be used for coinbase serialization later. (http://mining.bitcoin.cz/stratum-mining) ExtraNonce2Size = 0x4 }; return response; }
public SubscribeResponse SubscribeMiner(string miner) { this._counter++; var response = new SubscribeResponse { ExtraNonce1 = this._counter.ToString("x8"), // Hex-encoded, per-connection unique string which will be used for coinbase serialization later. (http://mining.bitcoin.cz/stratum-mining) ExtraNonce2Size = 0x4 }; return(response); }
public SubscribeResponse SubscribeMiner(string signature) { var context = (SocketServiceContext) JsonRpcContext.Current().Value; var miner = (IStratumMiner)(context.Miner); var response = new SubscribeResponse { ExtraNonce1 = miner.ExtraNonce.ToString("x8"), // Hex-encoded, per-connection unique string which will be used for coinbase serialization later. (http://mining.bitcoin.cz/stratum-mining) ExtraNonce2Size = ExtraNonce.ExpectedExtraNonce2Size // Represents expected length of extranonce2 which will be generated by the miner. (http://mining.bitcoin.cz/stratum-mining) }; miner.Subscribe(); return response; }