# How to use WebRTC in Java Processing?

**URL:** <https://discourse.processing.org/t/how-to-use-webrtc-in-java-processing/16757>\
**Category:** Libraries\
**Created:** [December 31, 2019, 2:08pm UTC](https://discourse.processing.org/t/how-to-use-webrtc-in-java-processing/16757 "2019-12-31T14:08:25Z")\
**Posts on this page:** 6\
**Page:** 1

<div class="post-metadata">

**Author:** ![anon68884268](https://avatars.discourse-cdn.com/v4/letter/a/59ef9b/32.png) [@anon68884268](https://discourse.processing.org/u/anon68884268)\
**Post date:** [December 31, 2019, 2:08pm UTC](https://discourse.processing.org/t/how-to-use-webrtc-in-java-processing/16757/1 "2019-12-31T14:08:25Z")

</div>

I heard about a internet protocol, which can send data to another computer in real-time, called WebRTC.  
Also i know, it’s for JavaScript (so probably for p5.js), but i want to use it for Java (normal Processing).  
Is there a way to do this, or can only JavaScript do this?

I saw it has it’s roots in RTP (https://en.wikipedia.org/wiki/Real-Time\_Transport\_Protocol)

My actually project is a whiteboard, which is on my mobile/tablet and my PC, and both can edit/erase it.

Thanks for your patience,  
Lightosk

---

<div class="post-metadata">

**Author:** ![kll](https://yyz2.discourse-cdn.com/flex036/user_avatar/discourse.processing.org/kll/32/964_2.png) [@kll](https://discourse.processing.org/u/kll)\
**Post date:** [December 31, 2019, 2:51pm UTC](https://discourse.processing.org/t/how-to-use-webrtc-in-java-processing/16757/2 "2019-12-31T14:51:55Z")

</div>

if you start first with communicating sketches  
on different computer, inside your local LAN  
play this 3 examples:  
[http://kll.engineering-news.org/kllfusion01/articles.php?article\_id=154#here28](http://kll.engineering-news.org/kllfusion01/articles.php?article_id=154#here28)

---

<div class="post-metadata">

**Author:** ![anon68884268](https://avatars.discourse-cdn.com/v4/letter/a/59ef9b/32.png) [@anon68884268](https://discourse.processing.org/u/anon68884268)\
**Post date:** [December 31, 2019, 3:01pm UTC](https://discourse.processing.org/t/how-to-use-webrtc-in-java-processing/16757/3 "2019-12-31T15:01:44Z")

</div>

Thank you!  
Nice website, and i found a link to the Network libary from Processing, from which i didn’t know it exists!

---

<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:** [December 31, 2019, 5:05pm UTC](https://discourse.processing.org/t/how-to-use-webrtc-in-java-processing/16757/4 "2019-12-31T17:05:19Z")

</div>

Hello,

Lots of resources out there:

> **[Welcome to Processing!](https://processing.org/)**
>
> Processing is a flexible software sketchbook and a language for learning how to code. Since 2001, Processing has promoted software literacy within the visual arts and visual literacy within technology…

> **[Network](https://processing.org/tutorials/network/)**
>
> An introduction to sending and receiving data with clients and servers.

[https://processing.org/tutorials/data/](https://processing.org/tutorials/data/)

> **[Network / Libraries](https://processing.org/reference/libraries/net/index.html)**
>
> Send and receive data over the Internet through simple clients and servers.

> **[Network / Libraries](https://processing.org/reference/libraries/net/index.html)**
>
> Send and receive data over the Internet through simple clients and servers.

> **[Guides](http://learningprocessing.com/examples/)**

> <https://github.com/processing/processing/tree/master/java/libraries/net>
>
> //github.com/processing/processing/tree/master/java/libraries/net

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

 ![image](https://canada1.discourse-cdn.com/flex036/uploads/processingfoundation1/original/2X/d/dc432adcf9c467168feb06ce1294de0dd7444f2f.png)

 ![image](https://canada1.discourse-cdn.com/flex036/uploads/processingfoundation1/original/2X/7/7bf4e78c99fa4eb0f240585a185813fcf5d83fd2.png)

And this forum!

I posted this as a demo of what can be done with Processing; I did not share code since it was for a student project and I was only providing guidance:

[![](https://img.youtube.com/vi/a1tNKAjXNC8/maxresdefault.jpg "Arduino to Processing") ](https://www.youtube.com/watch?v=a1tNKAjXNC8)

Arduino sends data (serial over USB) to Processing network server on PC.  
Processing network server sends data to Processing network client on another PC.  
Processing network client plots data.

🙂

---

<div class="post-metadata">

**Author:** ![anon68884268](https://avatars.discourse-cdn.com/v4/letter/a/59ef9b/32.png) [@anon68884268](https://discourse.processing.org/u/anon68884268)\
**Post date:** [December 31, 2019, 6:26pm UTC](https://discourse.processing.org/t/how-to-use-webrtc-in-java-processing/16757/5 "2019-12-31T18:26:41Z")

</div>

Hello,  
Well, I played with it and recognized, it’s TCP/IP. That’s not too bad, it will work fine. But for future I search for an robust connection. TCP/IP only works if it’s always connected, UDP is more tolerant. Does anybody know a libary, which roots base on UDP?

---

<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:** [December 31, 2019, 6:58pm UTC](https://discourse.processing.org/t/how-to-use-webrtc-in-java-processing/16757/6 "2019-12-31T18:58:31Z")

</div>

I came across this:

[https://shiffman.net/processing.org/udp/2010/11/13/streaming-video-with-udp-in-processing/](https://shiffman.net/processing.org/udp/2010/11/13/streaming-video-with-udp-in-processing/)

> <https://github.com/pscholl/processing/blob/master/libraries/udp/UDP.java>

 ![image](https://canada1.discourse-cdn.com/flex036/uploads/processingfoundation1/original/2X/f/ff9ad4d6732b86c69c0686cb586babb7b2c5ca94.png)

And this topic:

> [@Udp recreiving multiple ports](https://discourse.processing.org/t/udp-recreiving-multiple-ports/7516):
>
> I would like to extend the UDP object to allow for listening to multiple ports. Note the use of extends in the class definition. public class myUDP extends UDP{ String myIp; int myPort; String inMsg; boolean inMsgrdy; public myUDP( String ip, int port) { super(port); //super(this, ip, port) this not allowed this should be the UDP constructor super.setReceiveHandler("receivea"); //this does nothing myIp = ip; myPort = port; super.log…

🙂
