Noob question: what if I need complex server side operations?


#1

Hello All!
I am trying if and how DreamFactory can be used in a complex project, and couldn’t quite find a simple clear explanation yet.

I SEEMS to me that what DreamFactory does well is provide a an interface to access the database from a client side application, so that all coding can be done client-side. What I am wondering is if and how DreamFactory can be used when I need the server to work on the data as well, for example:

I am now developing a simple multi-player game, where I need the server (currenty usind Django) to compute quite a lot of stuff, which involves interactions between different players; the details of each player should never reach the clients, which only display the results of those interactions (for example each player can see the result of a battle his character took part in, but the actual battle is computed on the server).
Is DreamFactory good for such a scenario? Is it good for executing complex server-side code, or would it be a good middleware to dispatch communication between clients and a Django set-up (favourite alternatives?) which handles all the complex tasks?

Hope I made myself understood,
Thanks to anyone who can help me understand :slight_smile:


#2

DreamFactory supports server-side scripting with Javascript.

You can write scripts that are triggered on any API call, both on request and response.

You can also write custom scripts that can be invoked with a REST call.

Overview documentation is at https://github.com/dreamfactorysoftware/dsp-core/wiki/Server-Side-Scripting. There are links in the docs to a few blog posts that should also be helpful.


#3

Thanks! So scripts are the way to go. Still it seems that it might not be the best solution for my app since DreamFactory scripts seem designed form implementing small functionalities, while keeping most of the logic on the font-end (my app is a multiplayer game which involves lots of server-side computing, and currently consists of around 20k lines of code over 10s of source files (for the back-end, the front-end is about the same size)

If I understand it right DreamFactory is best used for applications where each client works together with the server, but independently from other users.

Would you agree with me, or am I missing something?

Thanks again!


#4

We’ve seen apps ported from node, so we can handle just about anything.
One thing we are working on , which is a compatibility problem with the latest version of the v8 engine is getting require available.

For now you can pull in your scripts with include below and have a fairly big app running behind the scenes.

var result;

try
{
    eval(include('my-lib.js'));
    result = 'myFunction() available: ' + myFunction();
} 

catch (_ex )
{
    result = 'myFunction() is NOT available: ' + _ex.message;
}

return result;