Sign In Register

How can we help you today?

Start a new topic
Answered

Running cloud code after response is sent to client

I was wondering if it is possible to run additional logic (i.e. make an external http request) from cloud code AFTER a cloud code response is sent to the user. I want to add an http request to some cloud code but I don't want to introduce latency to the request since this http request has nothing to do with the actual response to the client. 


I am not sure if something like a worker thread is supported via cloud code.


Thank you! 


Best Answer

Hi Laura


Is the event a custom log event request or a built in GameSparks request?

It is possible to put cloud code in the response but It would be run before the response is sent to the user.

If it has to be sent after the response is sent to the user,Then you would need to create a custom event  that is called after the response is retrieved.


Regards

Katie


Hi Laura,


You can use Spark.getScheduler() to do that, here's the documentation

https://docs2.gamesparks.com/tutorials/cloud-code-and-the-test-harness/scheduling-cloud-code.html


Answer

Hi Laura


Is the event a custom log event request or a built in GameSparks request?

It is possible to put cloud code in the response but It would be run before the response is sent to the user.

If it has to be sent after the response is sent to the user,Then you would need to create a custom event  that is called after the response is retrieved.


Regards

Katie

Login to post a comment