On 05.09.2017 11:17, IOhannes m zmoelnig wrote: > 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]). there is an external called purest-json (on deken) to deal with json-REST-APIs, but i have never tried it.
also it could be json over websockets, which makes a lot of sense for realtime applications. there is a very interesting 100%-vanilla-websocket-server patch here: https://sourceforge.net/projects/websocketserverinapatch/files/ no json in this one though. cheers, ub _______________________________________________ [email protected] mailing list UNSUBSCRIBE and account-management -> https://lists.puredata.info/listinfo/pd-list
