private static RequestDelegate NewEventService(Events e) { return(async(server, request, response) => { var pid = uint.Parse(request.Body); var hook = await MessageLoop.AddHook(e, pid).Task; await response.WriteText(hook.ToString()); }); }