# Run a processing sketch on a rpi as webserver

**URL:** <https://discourse.processing.org/t/run-a-processing-sketch-on-a-rpi-as-webserver/38559>\
**Category:** Project Guidance\
**Created:** [August 30, 2022, 1:23pm UTC](https://discourse.processing.org/t/run-a-processing-sketch-on-a-rpi-as-webserver/38559 "2022-08-30T13:23:29Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![bask185](https://avatars.discourse-cdn.com/v4/letter/b/3da27b/32.png) [@bask185](https://discourse.processing.org/u/bask185)\
**Post date:** [August 30, 2022, 1:23pm UTC](https://discourse.processing.org/t/run-a-processing-sketch-on-a-rpi-as-webserver/38559/1 "2022-08-30T13:23:30Z")

</div>

Hello,

I made a GUI in processing some time ago. The application itself can be used to draw a schematic for a modelrailway. This schematic is stored and loaded to and from CSV files.

 ![afbeelding](https://canada1.discourse-cdn.com/flex036/uploads/processingfoundation1/original/3X/6/1/61c0cdfe1a0f93ddfc9bc3420b8a542f20506f91.png)  
I know very little about modern webserver stuff.

I would like this sketch to run on a raspberry pi as a web server. I want to be able to use any computer with any webbrowser to interact with the application as a client.

Besides storing a layout on a CSV file, the content also needs to be sent via a serial port to an arduino board. As a standalone executable this all works fine, but now I want to use a client pc.

I have read a little about javascript. But this is mostly new to me. I do C, C++, python and a bit java, but that’s about it…

I do have some experience with running a server with a processing sketch. (with an wemos D1 mini as client) 😀

> **[Processing.js](https://happycoding.io/tutorials/processing/processing-js)**
>
> Embed your sketch in a webpage.

I tested the example and firefox could open and ‘play’ the .html file on my PC.

But how do I host that .html file as a webserver? Before I use the raspberry I would like to host this .html on my windows 10 PC. I can than use my smartphone or other PC with a browser to test.

Can I for instance make a webserver with a processing sketch and copy/paste the content of that html file inside that sketch?

Obviously my own application exists out of many .pde files. How exactly do I stuff that in a .html file?

Any pointers would be appreciated,

Bas

---

<div class="post-metadata">

**Author:** ![glv](https://yyz2.discourse-cdn.com/flex036/user_avatar/discourse.processing.org/glv/32/18785_2.png) [@glv](https://discourse.processing.org/u/glv)\
**Post date:** [August 30, 2022, 8:03pm UTC](https://discourse.processing.org/t/run-a-processing-sketch-on-a-rpi-as-webserver/38559/2 "2022-08-30T20:03:13Z")

</div>

Hello @bask185,

This may be of interest:

> [@\[Processing net POST request\] Error : Client got end of stream](https://discourse.processing.org/t/processing-net-post-request-error-client-got-end-of-stream/12339/9):
>
> I ported my Arduino web page “server” to Processing as a warm up exercise. There are better ways to deal with strings but just left it as is for now. // Web page is at http://127.0.0.1:20000/1 // Count on page increases with each refresh of page // The Processing console shows request from web page import processing.net.\*; Server s; Client c; String input; int data[]; int count = 0; int val = 0; void setup() { size(200, 200); // Starts a myServer on port 5204 s = new Server(…

`:)`
