DIY webserver & sockets connection

Note: For functionality like this, check out the Webserver DAT

Hey,

a while back I tried to make a simple websockets based chat app work with TouchDesigner and this little file was created.
All it does is use the TCP/IP DAT to act as a webserver on port 7001. The webpage it serves does not only contain the said chat but also 2 sliders which send their values back to TouchDesigner.

The whole thing is fairly simple:
If a client connects on port 7001 (just type localhost:7001 in your browser), the TcpIP callback analyzes the Header and sends back either the website to display or responds with a header that tells the Browser to switch into a Websocket connection.

If data is received which is not a header, the callback assumes that it must be a websocket message and starts decoding it.

There are some obvious problems here, especially the TcpIp DAT does not deal well with long messages send to it. Also the whole thing should be converted to deal with Bytes per Row instead of the currently used “One Row for all received Data”.
But this might be a good base for somebody trying to work on a browser based UI or so…

Cheers
Markus
TCPIPWebsocket.19.toe (17.6 KB)

That’s pretty cool! The video streaming plugin in the html won’t work in Chrome for me because of this support.google.com/chrome/answer/6213033 and in IE I get a black box. the slider demo works great tho.

Hey,

I think I had it working in ie and firefox with VLC installed. But yeah - the streaming was more for giggles as unfortunately HTML5 video container does not support rtsp streaming.

Cheers
Markus

Hello!

I see this post is 5 years and I was wondering if the video stream out function is already working properly with browsers like Chrome? I also tried the example and works wonderfull! I would like to buy the TD licence if this features works smoothly on others browsers already?

Hi @Skester96,

There are a few things that have changed in the meantime:

Cheers
Markus