Refresh posts and comments ( get new posts and comments) from graph api facebook.


Hi. I'm using graph api to get posts and comments from facebook page. But I want get the new posts or new comments. Means want to refresh the data coming from graph api.

Is there any way to do that in ASP.NET MVC? Thanks.


Asked by:- LuneAgile
0
: 2158 At:- 10/30/2018 8:52:53 PM
ASP.NET refresh-posts-comments-from-graph-api jQuery auto refresh web page







3 Answers
profileImage Answered by:- Vinnu

Yes Possible, using hangfire also, it is called Recurring jobs, you need to set a method in a hangfire to call it periodically.

Read this article https://qawithexperts.com/article/asp.net/background-jobs-in-aspnet-mvc-c-using-hangfireio/102 for more details about hangfire in asp.net/C#

2
At:- 11/1/2018 8:05:02 AM
Thanks so much Vinnu. 0
By : LuneAgile - at :- 11/1/2018 6:19:19 PM


profileImage Answered by:- vikas_jk

You can fetch new data from api by periodically calling api

 $(document).ready(function() {
  // SET AUTOMATIC call to function for 5000 MILISECONDS (5 SECONDS).
 setInterval('getNewPostsComments()', 5000);
});

function getNewPostsComments(){
  //Call server side method using AJAX
  //or Call api using Javascript
  //append new data
}

Whether you are pulling data from Server side C# code or front end code using javascript, from graph api, you can periodically call the function using AJAX to fetch data from api and if there are new posts or comments append it in your html code.

1
At:- 10/31/2018 12:07:53 PM


profileImage Answered by:- LuneAgile

Hi, Thanks, how can we do that using HangFire background jobs. to continuously look for new posts and comments I'm using code asp.net core2 to retrieve posts ans comments from graph api .

private List<posts> fbRetrievePosts(String  Url, String  AccessToken)
{

//

}
0
At:- 10/31/2018 1:43:41 PM






Login/Register to answer
Or
Register directly by posting answer/details

Full Name *

Email *




By posting your answer you agree on privacy policy & terms of use