Error "not yet implemented" When Attaching addListener() Listener to Realm Web App Object for Login/Logout Events

Hello MongoDB community,

I hope this message finds you well. I am currently working on integrating Realm Web into my application, and I have encountered an issue when attempting to attach a listener to the app object for login/logout events.

Here is a snippet of my code:

import { App } from 'realm-web';
import OneSignal from 'react-onesignal';

const app = new App({ id: process.env.REACT_APP_APP_ID });

const realmAuthCallback = (event) => {
    console.log('realmAuthCallback', event);
    if (event === 'login') {
        const user = app.currentUser;
        // Assuming 'EID' is somehow derived from the user information
        alert('OneSignal start');
        OneSignal.login(user.customData.uuid);
        OneSignal.User.addEmail(user.customData.email);
    } else if (event === 'logout') {
        OneSignal.logout();
    }
};

app.addListener(realmAuthCallback);

However, I am encountering the following error: “not yet implemented.” This happens when trying to add the listener to the realmAuthCallback callback.

I would appreciate any insights or guidance on resolving this issue. Am I using the listener correctly, or is there a different approach for handling login/logout events with Realm Web and OneSignal?

Thank you in advance for your help!

Best regards,

1 Like

The realm-web module does not yet support addListener(), whereas the realm module does. :frowning:

1 Like