User Streaming in Windows Phone

Sep 10, 2012 at 2:33 PM

int count = 0;
                var twitterCtx = new TwitterContext(auth);
                StreamContent streamContent = null;

                (from strm in twitterCtx.UserStream
                 where strm.Type == UserStreamType.User
                 select strm)
                    .StreamingCallback(strm =>
                    {
                        if (strm.Status == TwitterErrorStatus.RequestProcessingException)
                        {
                            WebException wex = strm.Error as WebException;
                            if (wex != null && wex.Status == WebExceptionStatus.ConnectFailure)
                            {
                                //Console.WriteLine(wex.Message + " You might want to reconnect.");
                            }

                            //Console.WriteLine(strm.Error.ToString());
                            return;
                        }
                        else if (strm.Status == TwitterErrorStatus.TwitterApiError)
                        {
                            return;
                        }

                        streamContent = strm;

                        //Console.WriteLine(strm.Content + "\n");

                        if (count++ >= 5)
                        {
                            strm.CloseStream();
                        }
                    })
                    .SingleOrDefault();

Hi Joe,

I am using above code for streaming User content on Windows Phone but stream callback never called. I am using your last checked in code (with 1.1 API changes).

Please suggest require code changes.

Thanks.

Coordinator
Sep 10, 2012 at 2:58 PM

Hi,

I've only worked on the REST API so far and haven't done any testing on Streams to see if they work with the new v1.1 endpoints yet.

There are a couple options here: (1) set the UserStreamUrl property of TwitterContext to the previous base url: https://userstream.twitter.com/2/ or (2) use the v1.0 libraries until I finish the conversion.

Joe

Sep 10, 2012 at 3:31 PM

I already tried both option, still same issue :(

Coordinator
Sep 30, 2012 at 5:44 AM

Found a fix for this and checked it in.

Joe

Sep 30, 2012 at 5:19 PM

Thanks joe will check. One more question.. linq2twitter fully gzipped?

Coordinator
Sep 30, 2012 at 5:51 PM

The client rest api supports gzip.  However, the windows phone profile and streams don't have it yet.  I added a new issue to support it.

Joe

Oct 4, 2012 at 3:46 AM

Thanks Joe