meshcat-dev / meshcat-python

WebGL-based 3D visualizer for Python
MIT License
254 stars 63 forks source link

Implement close() functionality for meshcat viewer and zmqserver that hosts the three.js webpage #138

Open kingjin94 opened 1 year ago

kingjin94 commented 1 year ago

Solves https://github.com/rdeits/meshcat-python/issues/87

kingjin94 commented 1 year ago

Tested with:

import meshcat.visualizer
vis = meshcat.visualizer.Visualizer()
vis.close()

prior to this patch vis.close() would fail and a manual killing of vis.window.server_proc would leave various processes running with ZMQbg prefix in htop's COMM / /proc//status -> Name.

Screenshot from 2023-06-30 15-59-39

Implements closing suggest, e.g., here: https://stackoverflow.com/questions/26224179/zmq-socket-gracefully-termination-in-python