realm-object-server icon indicating copy to clipboard operation
realm-object-server copied to clipboard

Feature Request: Trigger Function Execution From Client

Open BlueMilkApps opened this issue 7 years ago • 1 comments

Goals

Fire a Realm Function based by calling it directly from the Realm client. Node.js can obviously do this, so it would require opening it up and some modification to the client libraries to enable such a call. This is useful for doing various non-Realm things, like going and getting data from some API (weather, financial, heath, etc...). I realize you can do this by using some intermediary realm objects now, but it feels like an extra step for simple requests.

Expected Results

Call something like SyncUser.current.execute("nameOfFunc", args:(string/object or something)). The function would then kick off server-side, do it's async thing, and return JSON.

BlueMilkApps avatar Jun 01 '17 12:06 BlueMilkApps

@RiverbayChris thanks for filing this. We have explored formalizing an RPC pattern and will take this feedback as a reason to continue. Don't have anything to share just yet, since you obviously realize that you can set this up already via objects.

Such as creating a class just for communicating: RequestObject that might have a payload String property. Your Realm Function could listen to all of the users Realms that create these objects, such as making a dedicate /~/requests Realm and react to the insertions. An additional data property response on the object could be filled in by the server and a boolean property status could be used to communicate inProgress or completed.

Obviously formalizing this could help reduce the boilerplate and make this more straightforward.

bigfish24 avatar Jun 03 '17 01:06 bigfish24