Hi,
__Background information:__
I am trying to build a map either using MVC or WebForms that displays all of the geo-tagged tweets being tweeted in real time on the map. I want to use Tweetinvi's Twitter Streaming API functionality to do so.
__The problem:__
Having looked at all of the examples in the Examplinvi folder, they all seem to be for console-based or WinForms applications. Struggling to get my head around how I can access the Streaming API and asynchronously return the streaming result back to the page. I have seen examples using SignalR which enables the server to send data back to the client continuously but I don't know how TweetInvi can be used to do this in a web app. For example this code example is shown in the documentation:
```
// Access the filtered stream
var filteredStream = Stream.CreateFilteredStream();
filteredStream.AddTrack("ladygaga");
filteredStream.MatchingTweetReceived += (sender, args) => { Console.WriteLine(args.Tweet.Text); };
filteredStream.StartStreamMatchingAllConditions();
```
Obviously if this kind of pattern cannot be done with WebForms, that is okay; I am fine with MVC as well. I am struggling to envisage what kind of architectural pattern I need to implement to get this continuous HTTP connection setup. Do I need to setup an asynchronous Controller in my MVC application to continuously send data back to the client?
Sorry if this question is a bit muddled, but I would be eternally grateful if someone could point me in the right direction!
Comments: ** Comment from web user: linvi **
__Background information:__
I am trying to build a map either using MVC or WebForms that displays all of the geo-tagged tweets being tweeted in real time on the map. I want to use Tweetinvi's Twitter Streaming API functionality to do so.
__The problem:__
Having looked at all of the examples in the Examplinvi folder, they all seem to be for console-based or WinForms applications. Struggling to get my head around how I can access the Streaming API and asynchronously return the streaming result back to the page. I have seen examples using SignalR which enables the server to send data back to the client continuously but I don't know how TweetInvi can be used to do this in a web app. For example this code example is shown in the documentation:
```
// Access the filtered stream
var filteredStream = Stream.CreateFilteredStream();
filteredStream.AddTrack("ladygaga");
filteredStream.MatchingTweetReceived += (sender, args) => { Console.WriteLine(args.Tweet.Text); };
filteredStream.StartStreamMatchingAllConditions();
```
Obviously if this kind of pattern cannot be done with WebForms, that is okay; I am fine with MVC as well. I am struggling to envisage what kind of architectural pattern I need to implement to get this continuous HTTP connection setup. Do I need to setup an asynchronous Controller in my MVC application to continuously send data back to the client?
Sorry if this question is a bit muddled, but I would be eternally grateful if someone could point me in the right direction!
Comments: ** Comment from web user: linvi **
Hi there,
Please try to post this kind of question in the discussion forum, this section is about reporting bugs ;)
I am not sure how to implement a Session Thread in ASP but I will have a look into it tonight.
Otherwise I think the idea of SignalR is the way to go. And simply invoke your SignalR Hub each time the filteredStream.MatchingTweetReceived event is raised.
Something like the following:
``` c#
filteredStream.MatchingTweetReceived += (sender, args) => { Clients.All.BroadCastTweet(args.Tweet); }
```
I will let you know after I have done some tests tonight.
Linvi