Preview Socket is a protocol for extracting real-time images from modos' preview renderer. Preview Socket clients are separate applications that communicate with modo over a TCP/IP network connection or through pipes and implements the Preview Socket protocol.
While the name implies a TCP (socket) connection, a named pipe variant is also supported. For the purposes of this article, "Preview Socket" refers to both sockets and pipes unless otherwise indicated (usually by through the word "TCP" or "pipe').
Note that Preview Socket is only used for obtaining preview renders and setting up said renderer. Changes to the actual scene must be done through commands, either through modo itself or through Telnet.
High-level control of the Preview Socket server is done through commands.
- PreviewSocket.listen is used to start or stop listening for TCP connections on the given port. In other words, this starts and stops the Preview Socket server. Any number of clients can connect to the server, with each getting their own preview renderer.
- PreviewSocket.suspend pauses all connected clients, both on sockets and pipes. This is used to maintain sync with the internal application while other commands are being executed.
- PreviewPipe.start opens the named pipe. Unlike the TCP based server, only one client can be connected to the pipe at a time.
- PreviewPipe.stop closes the named pipe.
To start the server, execute previewSocket.listen.
previewSocket.listen port:12378 open:true
Once the port is open, clients can connect to setup a preview renderer and receive renderings.
Preview Socket uses a request/response protocol to communicate with clients.
... To Be Continued ---->