So rather take a chance in SignalR, instead? Just to do GUI updates on entity changes...
Then, would it rather make sense to extent the AbpCommonHub
?
From what the sparse documentation tels you should inherit it and extend it plus use yours it in the Startup.cs instead of AbpCommonHub.
app.UseEndpoints(endpoints =>
{
endpoints.MapHub<AbpCommonHub>("/signalr");
endpoints.MapHub<ChatHub>("/signalr-chat");
to
app.UseEndpoints(endpoints =>
{
endpoints.MapHub<MyCommonHub>("/signalr");
endpoints.MapHub<ChatHub>("/signalr-chat");
but from discussions I remember this caused problems somehow. Probably because strong references were made in other opaque code places.
Well, I came across that thread and the description, too. But honestly this is massively confusing. It kind of has/lacks the 'missing link' to the UI.... It did not resolve my problem and I still do not receive the client side callback.
What I understood:
So the notification system expects the GUI to call into some AppService
or Controller
where the code then cann call a SubscribeAsync()
with the current user from that session. Is it that????
So after working this all trough, I added this line in my AppService, where the listing calls across:
class MyObjekteAppService
{
...
public async Task<PagedResultDto<GetObjekteForViewDto>> GetAll(GetAllObjekteInput input)
{
try
{
// Subscribe for entity updates
await _notificationSubscriptionManager.SubscribeAsync(AbpSession.ToUserIdentifier(), "test.note.foobar", new EntityIdentifier(typeof(OBJEKTE), 0));
a directly following call to
var subs = await _notificationSubscriptionManager.GetSubscribedNotificationsAsync(AbpSession.ToUserIdentifier());
asserts, that this subscription has been added.
I use 0 here, and everywhere else, because I am rather interested in any update to OBJEKTE.
But still nothing happens on the client side.
Still the client side listens(?) to both events names, while just the first one would be right....
ngOnInit(): void {
alert("nginit");
abp.event.on('abp.notifications.received', function (userNotification) {
alert("event a" + userNotification);
});
abp.event.on('test.note.foobar', function (userNotification) {
alert("event foobar" + userNotification);
});
}
But perhaps this is not the right tool anyways? Because those entity updates I want to have do not really have to be persisted in any way.
I whish some clarification about that
Or maybe using SingalR instead would be wise?!?!