[PD] listing to json port?

Christof Ressi christof.ressi at gmx.at
Tue Sep 5 22:17:16 CEST 2017


you know, this is really ironic, the last hours I've been fiddling around building a very simple Pd websockets server. I finally got it to work but thought: "well, someone must have already done this" and wanted to ask on the list when I saw your mail! this guy's patch is quite crazy, he's even doing the SHA1 hashing of the Sec-Websocket-Key in Pd... where I made an external (using libopenssl). Anyway, I think I'll continue with my work, creating the basic building blocks as externals (which seems more maintainable to me... the pure vanilla solution is a bit complex to say the least) and then sharing the result on the list. 

websockets are actually pretty exciting. but I'm curious: are there other (better) ways to talk to a browser app with Pd in realtime situations? WebRTC looks quite promising...

Christof

> Gesendet: Dienstag, 05. September 2017 um 20:09 Uhr
> Von: "ub at xdv" <ub at xdv.org>
> An: pd-list at lists.iem.at
> Betreff: Re: [PD] listing to json port?
>
> 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
> 
> _______________________________________________
> Pd-list at lists.iem.at mailing list
> UNSUBSCRIBE and account-management -> https://lists.puredata.info/listinfo/pd-list
>



More information about the Pd-list mailing list