[PD] listing to json port?

João Pais jmmmpais at gmail.com
Wed Sep 6 09:56:36 CEST 2017


Ah yes, I didn't realize myself that the question wasn't placed in the  
correct way. What I need isn't just to listen to the port, but also to use  
json to make the websocket connection with the leapmotion through its api.  
That means, Pd would have to run the json code to get the data.
I guess I'll have to look at your suggestions. I can't distribute the json  
code (although maybe I could send to one or other individuals, instead to  
a list).

Best,

Joao

> On 09/05/17 02:31, João Pais wrote:
>>>> Hello list,
>>>>
>>>> I wanted to know if it's possible to listen to a port 6437, where some
>>>> json messages are coming in. I've seen in my webbrowser that the port  
>>>> is
>>>> indeed active, but when I try udpreceive nothing comes out - which
>>>> probably means that I'm not getting the process.
>>>
>>> tcpreceive?
>>
>> that would probably work, but I guess the javascript code is necessary
>> to open the port in the first place. Is there a way of Pd opening a html
>> file with that?
>
> i'm not sure i understand the problem.
> you write:
>
>> if it's possible to listen to a port 6437
>
> the answer is: yes of course.
> there are two things to keep in mind though:
> - you must know whether the protocol is TCP/IP or UDP. without that
> information, the port is pretty useless.
> since this is about JSON and web-technology, chances are high that the
> protocol is indeed TCP/IP, that's why is suggested to use [tcpreceive]
> instead of [udpreceive].
> - on a given machine, you can only have a single listener listening on a
> given port. so if you have a webbrowser already monitoring the data, you
> can *not* also have Pd doing the same (on the same machine).
>
> in any case, there also might be some confusion about "listening". it
> could well be, that you are trying to talk to a webserver that speaks
> JSON via a REST API. in which case, your Pd patch wouldn't *listen* but
> instead connect to the webserver ([tcpclient]).
>
> in any case, purest-json is a library (available via deken) that
> facilitates the interaction with JSON-based REST apis quite a lot.
> you probably should have a look at it.
>
> also note that with modern Pd, you can exchange your
> [tcpreceive]/[udpreceive] with the builtin [netreceive], which as gotten
> a binary mode ("-b") that will output the same format as [tcpreceive].
>
> fgasdrm
> IOhannes



More information about the Pd-list mailing list