It's the latter. It establishes a WebSocket connection and issues JavaScript commands to execute from the server. This connection remains persistently to allow bi-directional communication between client and server.
This occurs "behind the scenes", the developer will rarely need to think about it.
Is this just a DOM implementation that writes out the serialised form, or does it write our JavaScript to render whatever you've set, client side?