According to the specifications, it is always the client who should establish connection to a server.
A program or device that uses MQTT. A Client always establishes the Network Connection to the Server. It can
Publish Application Messages that other Clients might be interested in.
Subscribe to request Application Messages that it is interested in receiving.
Unsubscribe to remove a request for Application Messages.
Disconnect from the Server.
And if this client subscribes for an Application Message, then the server should forward those messages to this particular client.
A program or device that acts as an intermediary between Clients which publish Application Messages and Clients which have made Subscriptions. A Server
Accepts Network Connections from Clients.
Accepts Application Messages published by Clients.
Processes Subscribe and Unsubscribe requests from Clients.
Forwards Application Messages that match Client Subscriptions.
Does this mean that if a client subscribes, then it remains connected to the server while the subscription is valid even though there are no data flow in most of the time?
I come to this conclusion because if the client disconnects after subscription, then a server cannot forward messages to it because it is the client that should establish connection. But it won't know when to re-establish it.