# MosquittoServerResource

- Module: [CommunityToolkit.Aspire.Hosting.Mosquitto](/reference/api/typescript/communitytoolkit.aspire.hosting.mosquitto.md)
- Version: `13.5.0`
- Kind: `handle`
- Source: [GitHub](https://github.com/CommunityToolkit/Aspire/tree/4ff8268fbd97ddd23cb73dc8eff9cc92718156d1)

A resource that represents a Mosquitto MQTT broker container.

## Definition

```typescript
interface MosquittoServerResource
  extends IComputeResource,
    IExpressionValue,
    IManifestExpressionProvider,
    IResource,
    IResourceWithArgs,
    IResourceWithConnectionString,
    IResourceWithEndpoints,
    IResourceWithEnvironment,
    IResourceWithProbes,
    IResourceWithWaitSupport,
    IValueProvider,
    IValueWithReferences {
  readonly connectionStringExpression: ReferenceExpression;
  readonly host: EndpointReferenceExpression;
  readonly port: EndpointReferenceExpression;
  readonly primaryEndpoint: EndpointReference;
  readonly uriExpression: ReferenceExpression;
  withDataBindMount(
      source: string,
      isReadOnly?: boolean): MosquittoServerResource;
  withDataVolume(
      name?: string,
      isReadOnly?: boolean): MosquittoServerResource;
}
```

## Properties

- `connectionStringExpression`: `ReferenceExpression` `get` -- Gets the connection string expression for the Mosquitto broker in the form of `mqtt://host:port`, suitable for use by MQTT clients.
- `host`: `EndpointReferenceExpression` `get` -- Gets the host of the primary MQTT endpoint.
- `port`: `EndpointReferenceExpression` `get` -- Gets the port of the primary MQTT endpoint.
- `primaryEndpoint`: `EndpointReference` `get` -- Gets the primary MQTT endpoint for the Mosquitto broker.
- `uriExpression`: `ReferenceExpression` `get` -- Gets the connection URI expression for the Mosquitto broker.

## Methods

- [withDataBindMount](/reference/api/typescript/communitytoolkit.aspire.hosting.mosquitto/mosquittoserverresource/withdatabindmount.md) -- `method` -- Adds a bind mount for the data folder to a Mosquitto container resource.
    ```typescript
  withDataBindMount(source: string, isReadOnly?: boolean): MosquittoServerResource
  ```
- [withDataVolume](/reference/api/typescript/communitytoolkit.aspire.hosting.mosquitto/mosquittoserverresource/withdatavolume.md) -- `method` -- Adds a named volume for the data folder to a Mosquitto container resource.
    ```typescript
  withDataVolume(name?: string, isReadOnly?: boolean): MosquittoServerResource
  ```
