02-25-2013, 02:54 PM
Hi -
I wanted to integrate a small HTTP server into a QuickMacros application and I wanted to see if I was going to run into a problem too big to solve.
(The basic idea is to enable inter-machine access to applications using QuickMacros as a bridge; HTTP is pretty much supported everywhere).
What I was planning to do was:
I believe that the main programming issue would be how threading was handled. The events need to be handled in the same thread as the one where the COM object was instantiated: when a HTTP request comes in in C# I'll have to put the event into the thread that QM is expecting and then wait for the response from QM to return the data to the caller.
All of this seems doable although I'm sure I'll make plenty of mistakes. Is there anything that I'm missing that I should know about?
Thanks
Sean
I wanted to integrate a small HTTP server into a QuickMacros application and I wanted to see if I was going to run into a problem too big to solve.
(The basic idea is to enable inter-machine access to applications using QuickMacros as a bridge; HTTP is pretty much supported everywhere).
What I was planning to do was:
- Use an existing embedded HTTP server engine like Nancyhttps://github.com/NancyFx/Nancy#readme. This way I don't have to re-implement the HTTP server state machines, authentication, and a bunch of other things.
- I would wrap this in a COM object that I would instantiate from QuickMacros.
- When a URL was handled by the Nancy engine - I'd generate a COM event and handle this in a macro.
I believe that the main programming issue would be how threading was handled. The events need to be handled in the same thread as the one where the COM object was instantiated: when a HTTP request comes in in C# I'll have to put the event into the thread that QM is expecting and then wait for the response from QM to return the data to the caller.
All of this seems doable although I'm sure I'll make plenty of mistakes. Is there anything that I'm missing that I should know about?
Thanks
Sean