← Back to team overview

mosquitto-users team mailing list archive

Re: What kind of connection is used when bridging 2 brokers?

 

> What kind of connection is used when bridging 2 brokers? Websockets?
> CometD (HTTP)? UDP/TCP sockets  ...?

TCP sockets, just like, say, mosquitto_[sp]ub uses to connect to
Mosquitto.

> When establishing a connection from device to central server, does
> this means making a connection from device to central server in 1 go,
> or does the device connects to the central server and then the server
> connects (on another port) connects to the device?

A device (or Mosquitto in bridge mode connecting to a different broker)
opens a single TCP connection to the port you specify (e.g. 1883); all
communication (sub & pub) flow over that. A device is the client, and
that is the instance which connects to the broker. In the case you have
brokerA connect to a distant brokerB, it will be brokerA which initiates
the TCP connection.

> When the central server needs to send something to the device is at
> that moment the same connection used as the one which was used to
> connect the device to the central server? 

Correct. In other words, you need unhindered outgoing connections from a
device to a broker, or from a brokerA to a second brokerB. Incoming
connections are not required or necessary.

> Is there any limitation on how long the connection can be opened from
> the device to the central server and vice versa?

My understanding is that this is handled by the MQTT KEEPALIVE which is
set on a connection-basis when a device first connects to a broker.
During this time, PING requests/responses ensure that the device can
speak to the broker, and that the broker knows the device is alive.

Hope that helps,

        -JP


References