Websocket API to access shell of containers

How to connect to a running container through websocket API and run commands? Is there a documentations somewhere?

There is no specific Rancher API for exec, we just use the standard k8s API in the UI.