C#ã§æ¸ãç°¡æHTTPãµã¼ãã¼ï¼ã¨ããããã¯HTTPãªã¯ã¨ã¹ãåä¿¡ãµã¼ãï¼ï¼
ã¯ã¦ãªããã¯ãã¼ã¯ã®WebHookãä»ãããªãã触ã£ã¦ãããC#ã§ã¯ã¦ãWebHookåä¿¡æ©ãéçºä¸ã§ãã
ä»åã¯ãã®çºã®ç¬¬ä¸æ©ã¨ãã¦ç°¡æHTTPãµã¼ãã¼ã®ã³ã¼ããæ¸ãã¦ã¿ã¾ããã
ã¾ãHTTPãµã¼ãã¼ã¨ã¯è¨ã£ã¦ãã¾ãããå©ãããã¢ãã¬ã¹ï¼æ£ç¢ºã«ã¯ãã¹ï¼ã¨ã¯ã¨ãªæ
å ±ï¼QueryStringï¼ãåãåºãã³ã¼ãã§ãã
whileã§ç¡éã«ã¼ãããã¦HTTPãªã¯ã¨ã¹ããæ¥ãã®ããã£ã¨å¾
ã£ã¦ãã¾ãã
æ使ã£ããªã§ããã®ããã«ç¡éã«ã¼ãã§åºã¾ã£ããCPUã®ãã¯ã¼ãå
¨é¨æã£ã¦ãããªããå¿é
ã§ãããããããææã ã£ãããã§æ®éã«åãã¦ããã¾ããã
ã¾ãç¾ç¶ã§ã¯ãã¼ã解æ¾ãããããIPã¢ãã¬ã¹ã®ç´å©ãã«ãªã£ã¦ãã¾ãçºãWebHookãåä¿¡ã§ãã¾ããã
ããã¯æµè¡ã®ReverseHttpã¨ãããReverseHttpã¯ãµã¼ãã§ä½ãã¢ã¯ã·ã§ã³ãèµ·ããå ´åã«ããã©ã¦ã¶å´ããã®éç¥ãåä¿¡ãã...ãªãã¦äºãåºæ¥ããããã³ã«ããå©ç¨ãã¦ãããã¸ããä½ã¨ããããã¨æã£ã¦ãã¾ãã
ã¨ããã次ã®æ®µéã¯UpNPã®å®è£
ããããã¨æãã¾ãã
ããã§ã¯ï¼
以ä¸ããµã³ãã«ã³ã¼ã
static void Main(string[] args) { string prefix = "http://*/"; // åãä»ããURL HttpListener listener = new HttpListener(); listener.Prefixes.Add(prefix); // ãã¬ãã£ãã¯ã¹ã®ç»é² listener.Start(); while (true) { HttpListenerContext context = listener.GetContext(); HttpListenerRequest req = context.Request; HttpListenerResponse res = context.Response; Console.WriteLine(req.RawUrl); Console.WriteLine("---QueryString---"); Console.WriteLine(req.QueryString); res.Close(); } }