Communicating with logged on users after trigger fires

Taking a multi-user scrabble game as an example - 5 players in game - current player makes move which is sent to realm function - trigger fires on update to game table with new letter - game table contains player info for that game (disconnect at the moment between player info and info needed to communicate/push to that user) - is it possible to use realm features to send new letter back to all players of that game? looking at sync functionality but not sure it is relevant to situation above?

edit: just found “built-in services: push notification” … is this a good avenue to explore? Except users could be on desktop also.

Hi @Mic_Cross,
The Realm sync which is in beta might be an option.

However, I would explore using a collection.watch method from the relevant sdk of your choice.

Example see the react sdk:
https://docs.mongodb.com/realm-sdks/js/10.0.0-beta.9/Realm.RemoteMongoDBCollection.html

This is based in MongoDB change streams which listen to configure data changes and allow you to trigger an application logic on every relevant change.

Thanks,
Pavel

I am using WebSDK with GraphQL, ApolloClient etc - just found this in readme for RealmWeb: “the Realm Web project will not include a Realm Sync client in any foreseeable future.” " A limited selection of services are implemented at the moment:

  • Remote MongoDB (watching a collection is not yet implemented)." Explains why ‘const app = new RealmWeb.App({ id: REALM_APP_ID });’ creates an app object with no .objects, no watch etc.

We’re currently working on bringing MongoDB watch support to Realm Web (and it is already available in the legacy Stitch SDK for browsers).

A Realm Sync client in the Realm Web SDK is a different story (and technically a very different thing), as that won’t be available in any foreseeable future.

went back to mongodb stitch tutorial and have “add collection-level watch” working.

1 Like