public void WhenISubscribeForTheTopic(string topic) { var hubUrl = ((HubClient)ScenarioContext.Current["HubClient"]).HubUrl; var subscriberCallBackUrl = ScenarioContext.Current["SubscriberCallbackUrl"].ToString(); var responseStatusCode = PuSHSubscriber.Subscribe(hubUrl + "/subscribe", subscriberCallBackUrl, topic, PushSubscriber.PushVerifyType.Sync, 0, "verifytoken", null); ScenarioContext.Current.Add("SubscribeHttpResponseCode", responseStatusCode); }
static void Main(string[] args) { // So trace output will go to the console. Debug.Listeners.Add(new TextWriterTraceListener(Console.Out)); Debug.AutoFlush = true; var callback = new PushSubscriberCallback("http://+:8080/"); try { callback.Start(); callback.PushPost += callback_PushPost; callback.PushVerify += callback_PushVerify; // Subscribe to a feed Console.WriteLine("Subscribing to {0}", FeedToSubscribe); var statusCode = PuSHSubscriber.Subscribe( HubUrl, CallbackUrl, FeedToSubscribe, PushVerifyType.Sync, 0, "xyzzy", null); Console.WriteLine("Status code = " + statusCode); Console.WriteLine("Listening for connections from hub."); Console.WriteLine("Press Enter to exit program."); Console.ReadLine(); // Unsubscribe Console.WriteLine("Unsubscribing..."); statusCode = PuSHSubscriber.Unsubscribe( HubUrl, CallbackUrl, FeedToSubscribe, PushVerifyType.Sync, "xyzzy"); Console.WriteLine("Return value = " + statusCode); } finally { callback.Stop(); callback.Dispose(); } Debug.Flush(); }