Jump to content

Recommended Posts

CIAPI.CS offer streaming client listners for subscribing to new news event, but it does not seem compatible to WinPhone7. For WinPhone7 Microsoft offers a similar mechanism called Push Notifications. Is it possible to make CSAPI.CS compatible to Push Notifications?

Share this post


Link to post
Guest mrdavidlaing

Under the coveres, streaming is done over HTTP using an implementation of COMETD called Lightstreamer.

Lightstreamer has a Silverlight client library which CIAPI.CS uses. We’d need to port a copy of that to WinPhone7 if the Silverlight one doesn’t work out the box.

Feel free to give porting a go – fork https://github.com/cityindex/CIAPI.CS and have a look at src/StreamingClient.Silverlight and src/StreamingClient.Silverlight.Lightstreamer

Its unlikely that we’ll ever support Windows Phone Push Notifications. I’m not even sure if its appropriate for our use-case; we need to be able to stream up to 50 price channels containing up to 4 messages / second to most trading clients.

Share this post


Link to post

Under the coveres, streaming is done over HTTP using an implementation of COMETD called Lightstreamer.

Lightstreamer has a Silverlight client library which CIAPI.CS uses. We’d need to port a copy of that to WinPhone7 if the Silverlight one doesn’t work out the box.

Feel free to give porting a go – fork https://github.com/cityindex/CIAPI.CS and have a look at src/StreamingClient.Silverlight and src/StreamingClient.Silverlight.Lightstreamer

Its unlikely that we’ll ever support Windows Phone Push Notifications. I’m not even sure if its appropriate for our use-case; we need to be able to stream up to 50 price channels containing up to 4 messages / second to most trading clients.

Thanks, I would love to give it a try.

Share this post


Link to post

Under the coveres, streaming is done over HTTP using an implementation of COMETD called Lightstreamer.

Lightstreamer has a Silverlight client library which CIAPI.CS uses. We’d need to port a copy of that to WinPhone7 if the Silverlight one doesn’t work out the box.

Feel free to give porting a go – fork https://github.com/cityindex/CIAPI.CS and have a look at src/StreamingClient.Silverlight and src/StreamingClient.Silverlight.Lightstreamer

Its unlikely that we’ll ever support Windows Phone Push Notifications. I’m not even sure if its appropriate for our use-case; we need to be able to stream up to 50 price channels containing up to 4 messages / second to most trading clients.

Ok, I gave it a try and was successful. Now when I am testing subscribing from WinPhone7 I am not getting any error or exception but I am also not getting any result. Code for it is below, let me know if you can help in testing it:

public void SubscribeToNewsHeadlineStream()

{
        //First we need a valid session, obtained from the Rpc client
        var ctx = new CIAPI.Rpc.Client(RPC_URI);
        ctx.BeginLogIn(USERNAME, PASSWORD, a =>
        {
            ctx.EndLogIn(a);






            //Next we create a connection to the streaming api, using the authenticated session
            //You application should only ever have one of these
            var streamingClient = StreamingClientFactory.CreateStreamingClient(STREAMING_URI, USERNAME, ctx.SessionId);
            streamingClient.Connect();

            //And instantiate a listener for news headlines on the appropriate topic
            //You can have multiple listeners on one connection
            var newsListener = streamingClient.BuildListener<NewsDTO>("NEWS.MOCKHEADLINES.UK");
            newsListener.Start();

            //The MessageRecieved event will be triggered every time a new News headline is available,
            //so attach a handler for that event, and wait until something comes through
            //            var gate = new ManualResetEvent(false);
            NewsDTO recievedNewsHeadline = null;
            newsListener.MessageRecieved += (s, e) =>
            {
                recievedNewsHeadline = e.Data;
                //Do something with the new News headline data - perhaps update a news ticker?
                //gate.Set();
            };
            //gate.WaitOne();

            //Clean up
            //Stop any listeners
            newsListener.Stop();
            //Shut down the connection
            streamingClient.Disconnect();
            //Destroy your session
            ctx.BeginLogOut(result =>
            {
                // gate.Set();

Share this post


Link to post

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
×