Search the Community
Showing results for tags 'webservice'.
Found 2 results
-
[Release] oo_Webservice class using OOP
minipopov posted a topic in ARMA 3 - MISSION EDITING & SCRIPTING
Hello, I just release one class which use RscHTML to interact with API REST throw GET. You could check my code on: https://github.com/minipopov/WebService Don't forget to add ip from your webservice to in allowedHTMLLoadURIs (inside CfgCommands) like this exemple https://community.bistudio.com/wiki/CfgCommands Don't forget to add oop.h to your mission : https://github.com/code34/oop.h How to use instantiate class? private _webservice = ["new", "http://localhost:8080/"] call oo_WebService; Then put some args : private _arr = [ ["action", "update"], ["table", "users"], ["id", getPlayerUID] ]; ["putParam", _arr] call _webservice; And finally call it: private _index = "call" _webservice; It return index of request. You could get request state from index by getStatus private _data = ["getStatus", _index] call _webservice; Which is an array that contain in 0, the status of request "waiting"/"complete"/"timeout"(if request goes to timeout ofc..)/"undefine" if you give bad index. And at 1 the diag_ticktime when request was executed. So, as you could see there is timeout for request that you could set like this ["setTimeOut", 10] call _webservice; //time in second Old request are delete, you could set default time that script keep in memory request ["setKeepInMemory", 500] call _webservice; //Keep all request 500s after there exec Sadly, i didn't find any way to get the output of RscHTML... If anyone know the way to do it.. Hope it could be done to do something a bit more complex like get something in database or something like that.. Im so sorry for my fucking english.. ^^ Here:Exemple of usage: -
[Release] Send request to my bot discord
minipopov posted a topic in ARMA 3 - MISSION EDITING & SCRIPTING
As exemple for this topic:https://forums.bohemia.net/forums/topic/213192-release-oo_webservice-class-using-oop/ I create a bot discord:https://github.com/minipopov/DiscordBotExemple I create BaseFnc class, which have 2 antiflood system, one per user, one per call by everyone. i add a function named "sendGlobal" which send a text main channel on my discord: const globalMessage = new BaseFnc("sendGlobal", 10) // name of my function, time for antiflood globalMessage.setFloodProtection("perUser") // antiflood system perUser/perCall globalMessage.setCallback((params, steamID) => { // My callback chanGeneral.send(params.text) }); Then i import to my mission oo_Webservice and i create a class oo_Discord which use Webservice. You could check my mission:https://github.com/minipopov/Discord oo_Discord have 1 function "sendGlobal" which send httpRequest with those args: action => name of function to exec steamID => Who execute this call text => message to display on discord Now i make call private _discord = ["new", "http://localhost:8080/"] call oo_Discord; ["sendGlobal","Hello world!"] call _discord; I get this on my discord: http://prntscr.com/i1trv6 Make your own function function and imagine may be some new game/ interaction with people.- 1 reply
-
- 1
-
- oop
- webservice
-
(and 1 more)
Tagged with: