Is it possible for the Photon or Core to act as a web server?

I have been thinking here lately about the capabilities of the Photon (I own a few Cores) and an idea came to mind to see if it possible. A proof of concept, more or less.

Could a (possibly polymorphic) function be written that listens for GET requests and certain parameters, then parses a return string that contains an entire web page? The command switches could customize what exactly is sent and it would only contain a very simple web page.

Since the Particle API handles HTTP parsing, that would take some of the load off of the Photon, right?

Is this a possibility? Is it ill-advised or are there inherent issues with using it like this? What would be the likely difficulties with such a usage?

In the past, I’ve written a page on a particular device and then embedded the API calls with script blocks to populate info when a request is made, so, I know it works in that sense. I don’t need it to work one particular way or the other, I’m just wanting to see if it was possible and how it might be done.


There is this webserver library…

1 Like