View Single Post
Author Message
Me1
New Member
Join Date: Jan 2017
Old 07-20-2019 , 15:21   Callbacks not executed
Reply With Quote #1

Hi Guys
I am writing plugin which requires access to external resources, i chose REST requests and ripextextension this is part of my plugin with debug inserts

Code:
public void OnPluginStart()
{
    PrintToServer("Started");

    PrintToServer("1");
    HTTPClient hHTTPClient = new HTTPClient("https://httpbin.org");
    JSONObject hJSONObject = CreateJSONObject();
    PrintToServer("2");

    hHTTPClient.Get("get", OnHTTPResponse, 0);
    PrintToServer("3");

    hHTTPClient.Post("post", hJSONObject, OnHTTPResponse, 1);
    PrintToServer("4");

    hHTTPClient.Put("put", hJSONObject, OnHTTPResponse, 2);
    hHTTPClient.Patch("patch", hJSONObject, OnHTTPResponse, 3);
    hHTTPClient.Delete("delete", OnHTTPResponse, 4);
    hHTTPClient.Get("gzip", OnHTTPResponse, 5);

    delete hJSONObject;
    PrintToServer("Finished");

}

public void OnHTTPResponse(HTTPResponse response, any value)
{
    if (response.Status != HTTPStatus_OK) {
        PrintToServer("[ERR] %s Status: %d", sHTTPTags[value], response.Status);
        return;
    }
    if (response.Data == null) {
        PrintToServer("[OK] %s No response", sHTTPTags[value]);
        return;
    }

    char sData[1024];
    response.Data.ToString(sData, sizeof(sData), JSON_INDENT(4));

    PrintToServer("[OK] %s Response:\n%s", sHTTPTags[value], sData);
}

JSONObject CreateJSONObject()
{
    JSONObject hJSONObject = new JSONObject();
    hJSONObject.SetInt("id", 1);
    hJSONObject.SetFloat("jsonrpc", 2.0);
    hJSONObject.SetString("method", "subtract");

    JSONArray hJSONArray = new JSONArray();
    hJSONArray.PushInt(42);
    hJSONArray.PushInt(23);
    hJSONObject.Set("params", hJSONArray);

    delete hJSONArray;
    return hJSONObject;
}
And it's console output:
Code:
NET_CloseAllSockets
---- Host_NewGame ----
Host_NewGame on map zm_toxic_house3_hdr
CGameEventManager::AddListener: event 'teamplay_win_panel' unknown.
CGameEventManager::AddListener: event 'teamplay_restart_round' unknown.
CGameEventManager::AddListener: event 'arena_win_panel' unknown.
Started
1
2
3
4
Finished
GameTypes: missing mapgroupsSP entry for game type/mode (custom/custom).
I don't get responses from callbacks - like they were never called and no error messages - basically like these callbacks were empty functions. Initially i thought it's fault of extension so i tested curl, socket based, etc.
So now is my question, what are possible known root causes of such behaviour?
EDIT:
I am using sourcemod 1.10 (required for zombie plague by Qubka) - but this type of behaviours occurs also on 1.9
And it's also development server with no steam account token, but with gslt token sitation looks exactly the same
I also repeated everything on clear server that means only ripext + my plugin - which is basically modified ripext test ( only with PrintToServer added)

Last edited by Me1; 07-20-2019 at 17:36.
Me1 is offline