{"action":"created","issue":{"url":"https://api.github.com/repos/NyxStudios/TShock/issues/940","labels_url":"https://api.github.com/repos/NyxStudios/TShock/issues/940/labels{/name}","comments_url":"https://api.github.com/repos/NyxStudios/TShock/issues/940/comments","events_url":"https://api.github.com/repos/NyxStudios/TShock/issues/940/events","html_url":"https://github.com/NyxStudios/TShock/issues/940","id":88011303,"number":940,"title":"Deprecate HttpServer and primitive REST model in favor of a better solution","user":{"login":"tylerjwatson","id":5001408,"avatar_url":"https://avatars.githubusercontent.com/u/5001408?v=3","gravatar_id":"","url":"https://api.github.com/users/tylerjwatson","html_url":"https://github.com/tylerjwatson","followers_url":"https://api.github.com/users/tylerjwatson/followers","following_url":"https://api.github.com/users/tylerjwatson/following{/other_user}","gists_url":"https://api.github.com/users/tylerjwatson/gists{/gist_id}","starred_url":"https://api.github.com/users/tylerjwatson/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/tylerjwatson/subscriptions","organizations_url":"https://api.github.com/users/tylerjwatson/orgs","repos_url":"https://api.github.com/users/tylerjwatson/repos","events_url":"https://api.github.com/users/tylerjwatson/events{/privacy}","received_events_url":"https://api.github.com/users/tylerjwatson/received_events","type":"User","site_admin":false},"labels":[{"url":"https://api.github.com/repos/NyxStudios/TShock/labels/Improvement","name":"Improvement","color":"207de5"}],"state":"open","locked":false,"assignee":null,"milestone":null,"comments":3,"created_at":"2015-06-13T14:18:42Z","updated_at":"2015-06-13T18:53:43Z","closed_at":null,"body":"### Preface\r\n\r\nThe REST interface is probably one of the best intergation features of TShock.  It allows people to fetch information never previously possible from remote servers.  It serves as the web integration and administration point for every terraria server there is.\r\n\r\n### Problem\r\n\r\nThe `HttpServer` module used in TShock is extremely slow; requests to it can take up to 500ms using my own tests.  Each request to the `HttpServer` listener has about 6 `NullRefererenceException` objects thrown and swallowed, severely hurting its RTT performance.\r\n\r\nThe `HttpServer` module was inserted a long time ago in lieu of a workable HTTP server existing inside the .net framework at the time.\r\n\r\nThe REST object interface is also quite restrictive, and lacks support for modern C# programming techniques such as anonymous types, `dynamic`, and route-based action selectors.\r\n\r\n### Recommendation\r\n\r\n.It's now possible to host a full Web API 2.0 server inside any .NET app.  The OWIN stack is used by ASP.net MVC, Web API 2.0 and a lot of next-generation technologies.  It's _extemely_ fast, async, and very flexible in what it offers.  Furthermore, it's commercially supported and regularly updated.\r\n\r\nIt may bring TShock the following benefits:\r\n\r\n* Sub-ms round-trip times\r\n* The full power of the Web API 2.0 routing engine, including attribute routes, templates, etc\r\n* Fully async\r\n* Potential other OWIN features, such as SSO OAuth support (think steam authentication facebook, et. al)\r\n* CORS support\r\n* Possibility of a web interface via controllers and Razor views\r\n* Pretty much anything else in the web that runs on WebAPI 2.0\r\n* Request/respond via any serialization type: JSON, XML, Plain text without writing any extra code\r\n\r\nThe web API 2.0 stack is available from NuGet, and is embeddable into any application. \r\n\r\nMore information here: http://www.asp.net/web-api/overview/hosting-aspnet-web-api/use-owin-to-self-host-web-api\r\n\r\nIf a move to a full supported OWIN stack is not ideal, the replacement REST interface should at least be faster."},"comment":{"url":"https://api.github.com/repos/NyxStudios/TShock/issues/comments/111739803","html_url":"https://github.com/NyxStudios/TShock/issues/940#issuecomment-111739803","issue_url":"https://api.github.com/repos/NyxStudios/TShock/issues/940","id":111739803,"user":{"login":"nicatronTg","id":532647,"avatar_url":"https://avatars.githubusercontent.com/u/532647?v=3","gravatar_id":"","url":"https://api.github.com/users/nicatronTg","html_url":"https://github.com/nicatronTg","followers_url":"https://api.github.com/users/nicatronTg/followers","following_url":"https://api.github.com/users/nicatronTg/following{/other_user}","gists_url":"https://api.github.com/users/nicatronTg/gists{/gist_id}","starred_url":"https://api.github.com/users/nicatronTg/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/nicatronTg/subscriptions","organizations_url":"https://api.github.com/users/nicatronTg/orgs","repos_url":"https://api.github.com/users/nicatronTg/repos","events_url":"https://api.github.com/users/nicatronTg/events{/privacy}","received_events_url":"https://api.github.com/users/nicatronTg/received_events","type":"User","site_admin":false},"created_at":"2015-06-13T18:53:43Z","updated_at":"2015-06-13T18:53:43Z","body":"_The project lead for Orion is really @WhiteXZ_"}}