Hi, apologies if I’m missing something simple, but I’m having trouble getting a callback about a new entry using Realtime. Can you let me know what I’m doing incorrectly? For reference, I’m using the Backendless .NET SDK version 6.7.1.
After signing in to Backendless on a locally running app, I’m calling var myTable = BackendlessAPI.Backendless.Data.Of(“MyTable”).RT()
, followed by myTable.AddCreateListener()
as per the documentation. I’ve also set up a Backendless.RT.AddConnectListener().
Via the debugger, I see that the myTable.AddCreateListener() callback is being created, and afterward the AddConnectListener callback is being called. However when I then sign in via a deployed Azure app with a different user, and add a new entry to MyTable, the AddCreateListener callback is not called.
Thanks,
Nate
Hello, @Nathan_Loring.
Can you send part of the code with logic that you used?
Regards, Nikita.
Hi Nikita, sure I can try to provide some more relevant information.
Originally I tested this with two different instances of my application, but now I’ve tested this using only a single instance. This is a Blazor Server application and I’m testing it in Debug mode via IDE.
-
Log in:
Backendless.UserService.LoginAsync(login, password)
-
After login succeeds:
var productsEventHandler = BackendlessAPI.Backendless.Data.Of(“Products”).RT();
productsEventHandler?.AddCreateListener(OnProductsRecordCreated);
-
Then the Console shows:
BACKENDLESS LOG:try to subscribe RTSubscription{id=‘‘, callback=BackendlessAPI.RT.RTCallback1[System.Collections.Generic.Dictionary
2[System.String,System.Object]], subscriptionName=OBJECTS_CHANGES, options=System.Collections.Generic.Dictionary`2[System.String,System.Object]}
BACKENDLESS LOG:Connected event System.EventArgs
BACKENDLESS LOG:subOn called
RT Client connected
-
There’s a breakpoint set in:
private void OnProductsRecordCreated(Dictionary<string, object> dictionary)
{
logger.LogInformation(“Created a product record: {}”, dictionary[“objectId”]);
}
-
Create a new Products record:
var uow = new UnitOfWork();
var createOpResult = uow.Create(“Products”, objectMap);
var uowResult = uow.Execute();
The Create operation succeeds and I see the new record in the Backendless Data Browser. However the breakpoint in OnProductsTableRecordCreated is not hit. I don’t see any additional messages in the Console.
Ok, @Nathan_Loring.
Can you try with Backendless.Data.Of("Products").Save(yourObject)
operation?
Regards, Nikita.
Sure, I just tested Backendless.Data.Of("Products").Save(theObject)
instead of using UnitOfWork. A Dictionary<string, object> was returned and I verified that the new record exists via the Data Browser, but unfortunately the OnProductsTableRecordCreated() method still wasn’t called.
Ok, thank you. I will check to this as soon as possible.
Regards, Nikita.
Hello, @Nathan_Loring.
Are you using custom domain or appId + apiKey for initialize application in sdk?
Regards, Nikita.