# Processing and webpage

**URL:** <https://discourse.processing.org/t/processing-and-webpage/27799>\
**Category:** Project Guidance\
**Created:** [February 13, 2021, 4:58pm UTC](https://discourse.processing.org/t/processing-and-webpage/27799 "2021-02-13T16:58:28Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![yanze03](https://avatars.discourse-cdn.com/v4/letter/y/e9a140/32.png) [@yanze03](https://discourse.processing.org/u/yanze03)\
**Post date:** [February 13, 2021, 4:58pm UTC](https://discourse.processing.org/t/processing-and-webpage/27799/1 "2021-02-13T16:58:28Z")

</div>

It is possible to get data from a webpage into your processing sketch. I know how to get pictures from the internet into the skecth or how to link to a website. But can you go the other way around? Is it possible to for example type a name in my processing sketch and send it to a website where I can see the name I typed in my sketch?

---

<div class="post-metadata">

**Author:** ![josephh](https://yyz2.discourse-cdn.com/flex036/user_avatar/discourse.processing.org/josephh/32/210_2.png) [@josephh](https://discourse.processing.org/u/josephh)\
**Post date:** [February 14, 2021, 12:58am UTC](https://discourse.processing.org/t/processing-and-webpage/27799/2 "2021-02-14T00:58:25Z")

</div>

Hi,

One way of doing this is to use [WebSockets](https://en.wikipedia.org/wiki/WebSocket), which is an extension of the HTTP protocol but full-duplex which means that both the server and the client can exchange in both directions without having to open and close a new connection.

This is great for real time interaction between two processes/machines over a network.

Seems like there’s already a Processing library to do that!!

> **[alexandrainst/processing\_websockets](https://github.com/alexandrainst/processing_websockets)**
>
> A web socket library, including both server and client, for Processing

And creating a WebSocket client application in JavaScript is very easy :

[https://developer.mozilla.org/en-US/docs/Web/API/WebSockets\_API/Writing\_WebSocket\_client\_applications](https://developer.mozilla.org/en-US/docs/Web/API/WebSockets_API/Writing_WebSocket_client_applications)

So when you type something on the Processing sketch, you send a JSON message through sockets with the event or the full text and in the client web page, you update the text dynamically through DOM manipulation 😉
