Use of docker.sock vs websocket in rancher agent

Can someone pls explain about the docker.sock & websockets that gets created while installing the rancher agent ?

What is the purpose of mounting -v /var/run/docker.sock:/var/run/docker.sock while installing rancher agent i.e. is this socket being used for launching other rancher services that are launched when installing the rancher agent ? Is it used for managing containers launched in that host or for container communication across hosts?

Websockets are used for host to communicate with the master but do they use the docker.sock begin created or something different.

Pls clarify how docker.sock and websocket are used in rancher agent.

I believe that the websockets is used so that the server can stream information back and forth between the server and agents without having to use HTTP requests and responses.

http://rancher.com/docs/rancher/v1.6/en/api/v2-beta/#websockets

The docker.sock is how the agent is able to launch other containers when directed to by the orchestration.

The agent opens a websocket connection to the server to send and receive info to/from the server container. docker.sock is a local Unix socket to communicate with the Docker API, which the agent used to manipulate the containers on the host.

The UI also uses an unrelated websocket to receive change events and keep the screen up to date as resources change in the backend.