Hi I saw tha is it possible to do http.request via cloudscript.
I look for a method to do a TCP request to my own api. Is it possible via Cloud script?
There is a dedicated apit to do this?
Hi I saw tha is it possible to do http.request via cloudscript.
I look for a method to do a TCP request to my own api. Is it possible via Cloud script?
There is a dedicated apit to do this?
Yes, you can make Http requests from CloudScript to any web API endpoint, using standard REST calls. You can check this documentation -- Making Webhook calls from CloudScript for more details about how to do a web API call from CloudScript. Besides, you can navigate to [Game Manager]->[Automation]->[Cloud Script]->[Revision] to find the following sample in the [Revision 1].
// This is a simple example of making a web request to an external HTTP API. handlers.makeHTTPRequest = function (args, context) { var headers = { "X-MyCustomHeader": "Some Value" }; var body = { input: args, userId: currentPlayerId, mode: "foobar" }; var url = "http://httpbin.org/status/200"; var content = JSON.stringify(body); var httpMethod = "post"; var contentType = "application/json"; // The pre-defined http object makes synchronous HTTP requests var response = http.request(url, httpMethod, content, contentType, headers); return { responseContent: response }; };
Http calls that based on TCP are OK. It doesn't support the long connection.
I don't need a long connection but to call a mirror server.
2 People are following this question.