[p5.js] Communication-related in 'P5', is UDP or TCP possible?

  1. This is related to socket communication.
    p5.js, node.js, socket.io · processing/p5.js Wiki · GitHub

  2. node.js
    Node js를 이용하여 UDP Server와 Client 만들기 - SW 기술 블로그 (Q&A)

Communication-related in ‘P5’, is UDP or TCP possible?
I want send and receive to be implemented. Is it possible?

UDP is definitely not something you can do from JavaScript in a web browser. Arbitrary TCP is also not possible, however HTTP technically is a TCP based protocol, and “web sockets” can be used very much like a TCP connection between JavaScript in a web browser and an HTTP server expecting such a connection. Libraries such as socket.io are designed to facilitate the use of web sockets to send messages back and forth between web browsers and servers (they actually leverage a few different techniques depending on browser compatibility).

P5.js itself does not have any special support for web sockets, but it does have some helper functions for issuing HTTP requests and loading data from URLs fetched via HTTP: p5.js IO functions.



Dear Kumu Paul,

Thanks for your kind reply.

Depending on the situation, it should be developed in ‘JAVA mode’ or through ‘WEB’.
In ‘JAVA mode’, it mainly communicates with the server using TCP/IP & UDP.
Implementation with ‘p5.js’ requires re-framing the communication.
(Of course, the screen composition will have to be redesigned.)

I fully understood through your answer. thank you.