News API: Notifications (SignalR)
Note
Please refer to this documentation to properly install and use our Push Notifications with SignalR.
Subscribe to Post Notifications
Message Format
When a post is created
public class ExtendedPost
{
public Guid Id { get; set; }
public string Title { get; set; }
public string Summary { get; set; }
public string HTML { get; set; }
public string Url { get; set; }
public string FullUrl { get; set; }
public int ContentTypeId { get; set; }
public Company Company { get; set; }
public Author Author { get; set; }
public Guid FeedId{ get; set; }
public DateTime CreationDate { get; set; }
public DateTime? ModificationDate { get; set; }
public DateTime PublicationDate { get; set; }
public List Tags { get; set; }
public CalendarEvent Event { get; set; }
public SEO Seo { get; set; }
public Video Video { get; set; }
public Image Image { get; set; }
public Language Language { get; set; }
}
When a post is deleted
public class PostDeletedDto
{
public Guid PostId { get; set; }
public Guid LanguageId { get; set; }
public Guid FeedId { get; set; }
}
Code Sample (C#)
var token = getTokenApi();
var queryStringToken = string.Format("?access_token={0}", token.AccessToken);
var hubConnection = new HubConnection("https://httppush.fxstreet.com/", queryStringToken);
var hubProxy = hubConnection.CreateHubProxy("PostHub");
hubProxy.On("postCreated", data =>
{
var post = data;
});
hubProxy.On("postDeleted", data =>
{
var postId = data;
});
hubConnection.Start().ContinueWith(x =>
{
hubProxy.Invoke("subscribe", "en-US", "NewsPushNotification");
}).Wait();
Available Cultures
[
{ "Name": "en-US" },
{ "Name": "zh-CHT" },
{ "Name": "es-ES" },
{ "Name": "zh-CN" },
{ "Name": "ja-JP" },
{ "Name": "ru-RU" },
{ "Name": "ca-ES" },
{ "Name": "ar-AE" },
{ "Name": "id-ID" },
{ "Name": "tr-TR" },
{ "Name": "hu-HU" },
{ "Name": "fr-FR" },
{ "Name": "de-DE" },
{ "Name": "hi-IN" },
{ "Name": "pt-PT" },
{ "Name": "it-IT" },
{ "Name": "ko-KR" },
{ "Name": "pl-PL" },
{ "Name": "vi-VN" },
{ "Name": "fa-IR" }
]