나는 앱의 대시 보드를 통해 Facebook (사용자 및 페이지)에 대한 실시간 업데이트를 설정하고 Facebook으로부터 성공 메시지를 받았습니다. 그러나 그 후 나는 페이스 북으로부터 어떤 메시지도받지 못한다. 사용자가 앱을 사용하는 페이지의 게시물에 댓글을 달면 Facebook이 있어야한다고해도 Facebook에서 알림이 전송됩니다.Facebook 실시간 업데이트가 작동하지 않음
실시간 업데이트에 관한 Facebook 개발자 페이지의 모든 내용을 읽었으며 Google을 사용하여 인터넷을 검색했지만 작동하지 않는 이유를 이해할 수 없습니다.
누군가가 잘못된 정보를 알고 있습니까? 누군가 내가 왜 업데이트를받지 못하는지 알고 있습니까?
감사합니다, 조나스
는 여기에 페이스 북의 게시물을 처리하기 위해 사용하는 코드입니다. 그러나 아니요 Facebook에서 로그인 한 경우 구독을 설정하고 시작하는 데 사용 된 것을 제외하고는 IIS에 로그인했습니다.
protected void Page_Load(object sender, EventArgs e)
{
String verify_token_created_in_app = "1234";
logger.Error("Nu borde det synas");
String hub_mode = Request.QueryString["hub.mode"];
String hub_challenge = Request.QueryString["hub.challenge"];
String hub_verify_token = Request.QueryString["hub.verify_token"];
int customerId = Convert.ToInt32(Request.QueryString["c"]);
if (hub_mode == null)
{
hub_mode = "";
}
if (hub_challenge == null)
{
hub_challenge = "";
}
if (hub_verify_token == null)
{
hub_verify_token = "";
}
if (hub_verify_token.Equals(verify_token_created_in_app))
{
Response.Write(hub_challenge);
}
if (hub_mode == "" || hub_challenge == "" || hub_verify_token == "")
{
HttpCookie sessionCookie = new HttpCookie("facilSession");
HttpContext.Current.Response.Cookies.Add(sessionCookie);
Utilities.customerId = customerId;
spreadClass spread = new spreadClass();
var client = new FacebookClient(spread.mfbAccessToken);
string jsonString = "";
realTimeUpdateParser = new RealTimeUpdateParser();
List<RealTimeUpdateParser> realTimeUpdateParserList = new List<RealTimeUpdateParser>();
try
{
logger.Error("Inne i metoden som ska läsa JSON från Facebook");
// VerifyPostSubscription will throw exception if verification fails.
dynamic result = client.VerifyPostSubscription(
Request.Headers["X-Hub-Signature"],
new StreamReader(Request.InputStream).ReadToEnd());
// result is a json object that was sent by Facebook
// for now just call ToString() so it returns the json string
jsonString = result.ToString();
logger.Error("jsonString: " + jsonString);
// Process the result
// for this demo we will just add it to the list
}
catch (Exception ex)
{
logger.Error("Error: " + ex.Message);
}
realTimeUpdateParserList = JsonConvert.DeserializeObject<List<RealTimeUpdateParser>>(jsonString);
ConnectToFacebookAPI connectToFacebookAPI = new ConnectToFacebookAPI(client, spread);
connectToFacebookAPI.HandleRealTimeUpdateFromFacebook(realTimeUpdateParserList, customerId);
}
}
당신은 당신이 POST 콜백을 수신하는 데 사용되는 코드를 표시 할 수 있습니다. – phwd
이 코드는 일반적인 wed 양식 asp.net 페이지의 코드에서 처리됩니다. .NET 4.0 사용하고 있습니다. –
나는 이제 IIS의 로그 파일에 기록 된 Facebook 게시물을 믿습니다. 로그 항목에는 신뢰할 수있는 IP 주소, 올바른 URL 및 올바른 http 메소드 (POST)가 있습니다. 하지만 코드가 작동 할 가능성이 있습니까? 유용한 디버그 정보를 얻으려면 아직 NLog (http://nlog-project.org/)를 올바르게 설정할 수 없었습니다. –