# AddMosquitto

- Module: [CommunityToolkit.Aspire.Hosting.Mosquitto](/reference/api/go/communitytoolkit.aspire.hosting.mosquitto.md)
- Version: `13.6.1`
- Kind: `method`
- Defined on: `DistributedApplicationBuilder`
- Source: [GitHub](https://github.com/CommunityToolkit/Aspire/tree/d9c2addac6f527ef2e33712d290b84574b455a3b)

Adds a Mosquitto container resource to the application. Mosquitto is an open source MQTT message broker, so the resource can be referenced by any MQTT client integration.

## Remarks

This version of the package defaults to the tag of the container image.

## Definition

```go
func (DistributedApplicationBuilder) AddMosquitto(
    name string,
    options ...*AddMosquittoOptions,
) MosquittoServerResource
```

## Parameters

- `name` (`string`) -- The name of the resource. This name is used as the connection string name when referenced in a dependency.
- `options` (`...*AddMosquittoOptions`) -- optional settings, see [Options](#options)

## Options

Optional parameters are passed in a trailing `options ...*AddMosquittoOptions` argument.

- `Port` (`*float64`) -- The host port that the MQTT endpoint is exposed on. If `null` a random port is assigned.

## Returns

[`MosquittoServerResource`](/reference/api/go/communitytoolkit.aspire.hosting.mosquitto/mosquittoserverresource.md) -- A reference to the `IResourceBuilder`.

Returns a handle; failures surface later via `Err()`.

## Applies to

- `DistributedApplicationBuilder`
