void OnEnable() { _stateUpdateService = GetComponent <StateUpdateService>(); _server = new WebServer("http://localhost:46697/"); _server.RegisterModule(new WebApiModule()); _server.Module <WebApiModule>().RegisterController((context) => { return(new UpdateController(context, _stateUpdateService)); }); Debug.Log("Starting HTTP Server..."); _server.RunAsync().ContinueWith(t => Debug.Log("HTTP ERROR: " + t.Exception), TaskContinuationOptions.OnlyOnFaulted); }
public UpdateController(IHttpContext context, StateUpdateService stateUpdateService) : base(context) { _stateUpdateService = stateUpdateService; }