{"id":13589077,"url":"https://github.com/PushkinStudio/PsWebServer","last_synced_at":"2025-04-08T07:31:42.239Z","repository":{"id":44660643,"uuid":"169195390","full_name":"PushkinStudio/PsWebServer","owner":"PushkinStudio","description":"Civet web server integration plugin for Unreal Engine 4","archived":false,"fork":false,"pushed_at":"2024-08-12T12:28:26.000Z","size":477,"stargazers_count":32,"open_issues_count":1,"forks_count":17,"subscribers_count":15,"default_branch":"develop","last_synced_at":"2024-11-06T08:43:39.540Z","etag":null,"topics":["civet","civetweb","cpp","mit-license","network","ue4","ue4-plugin","unreal-engine","unreal-engine-4","webserver"],"latest_commit_sha":null,"homepage":null,"language":"C","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/PushkinStudio.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2019-02-05T05:35:09.000Z","updated_at":"2024-07-01T21:40:11.000Z","dependencies_parsed_at":"2022-09-24T23:51:43.186Z","dependency_job_id":null,"html_url":"https://github.com/PushkinStudio/PsWebServer","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/PushkinStudio%2FPsWebServer","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/PushkinStudio%2FPsWebServer/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/PushkinStudio%2FPsWebServer/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/PushkinStudio%2FPsWebServer/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/PushkinStudio","download_url":"https://codeload.github.com/PushkinStudio/PsWebServer/tar.gz/refs/heads/develop","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":247796181,"owners_count":20997526,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["civet","civetweb","cpp","mit-license","network","ue4","ue4-plugin","unreal-engine","unreal-engine-4","webserver"],"created_at":"2024-08-01T16:00:22.393Z","updated_at":"2025-04-08T07:31:41.168Z","avatar_url":"https://github.com/PushkinStudio.png","language":"C","readme":"# PsWebServer\n\nCivet web server integration plugin for Unreal Engine 4\n\n# HowTo\n\nWeb server usage (f.e. in AMyGameMode::BeginPlay()))\n\n```cpp\n// Launch web server\nWebServer = NewObject\u003cUPsWebServerWrapper\u003e(this);\nWebServer-\u003eStartServer();\n\n// Create and register api handler\nauto PingHandler = NewObject\u003cUMyServerPingHandler\u003e(this);\nPingHandler-\u003eSetHeader(TEXT(\"Server\"), TEXT(\"MyServer/\") + MyGI-\u003eGetGameVersion());     // Optional header set\nWebServer-\u003eAddHandler(PingHandler, TEXT(\"/api/ping\"));\n```\n\nIf uses `UMyServerPingHandler` class that defined as:\n\n```cpp\n#pragma once\n\n#include \"PsWebServerHandler.h\"\n\n#include \"MyServerPingHandler.generated.h\"\n\nUCLASS()\nclass UMyServerPingHandler : public UPsWebServerHandler\n{\n\tGENERATED_BODY()\n\npublic:\n\t/** Override to implement your custom logic of request processing */\n\tvirtual void ProcessRequest_Implementation(const FGuid\u0026 RequestUniqueId, const FString\u0026 RequestData) override;\n};\n\n```\n\nAnd its definition:\n\n```cpp\n#include \"MyServerPingHandler.h\"\n\n#include \"PsWebServerDefines.h\"\n#include \"VaRestJsonObject.h\"\n\n/*\n * Check that request has valid json encoded body and return its copy in response\n */\nvoid UMyServerPingHandler::ProcessRequest_Implementation(const FGuid\u0026 RequestUniqueId, const FString\u0026 RequestData)\n{\n\t// Validate json format with VaRest\n\tUVaRestJsonObject* JsonTemp = UVaRestJsonObject::ConstructJsonObject(this);\n\tif (JsonTemp-\u003eDecodeJson(RequestData))\n\t{\n\t\tProcessRequestFinish(RequestUniqueId, FString::Printf(TEXT(\"{\\\"request_data\\\":%s}\"), *RequestData));\n\t\treturn;\n\t}\n\n\tUE_LOG(LogMyGame, Error, TEXT(\"%s: can't validate data as json one: %s\"), *PS_FUNC_LINE, *RequestData);\n\n\tconst FString ErrorStr = TEXT(R\"({\"error\":\"1000\",\"message\":\"Request data is not a valid json object\"})\");\n\tProcessRequestFinish(RequestUniqueId, ErrorStr);\n}\n```\n","funding_links":[],"categories":["Plugin"],"sub_categories":[],"project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2FPushkinStudio%2FPsWebServer","html_url":"https://awesome.ecosyste.ms/projects/github.com%2FPushkinStudio%2FPsWebServer","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2FPushkinStudio%2FPsWebServer/lists"}