I`m forgetting something:
How does Pd speaks to the GUI/Javascript?
Over a TCP socket connection.
In C there's a generic interface for sending ints, floats, strings, and arrays containing them. In s_inter.c I scoop all that up into something resembling a list of comma-separated arguments to a function. In pdgui.js there's about 20 lines for a parser that formats all that into function calls and evaluates them.
OSC?
There's no need for OSC in this case.
-Jonathan