# Hive websocket connection failure

**URL:** <https://community.hivemq.com/t/hive-websocket-connection-failure/1217>\
**Category:** HiveMQ Community Edition\
**Created:** [May 16, 2022, 6:59pm UTC](https://community.hivemq.com/t/hive-websocket-connection-failure/1217 "2022-05-16T18:59:26Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![a14guguliye](https://avatars.discourse-cdn.com/v4/letter/a/8491ac/32.png) [@a14guguliye](https://community.hivemq.com/u/a14guguliye)\
**Post date:** [May 16, 2022, 6:59pm UTC](https://community.hivemq.com/t/hive-websocket-connection-failure/1217/1 "2022-05-16T18:59:26Z")

</div>

Hello All,  
I use below flutter code to connect to the HIVE broker via browser, however, I fail  
i have no clue how to proceed  
Can someone please help?

```auto
import 'package:flutter/cupertino.dart';
import 'package:mqtt_client/mqtt_browser_client.dart';
import 'package:mqtt_client/mqtt_client.dart';

MqttBrowserClient mq = MqttBrowserClient(
    'ws://broker.mqttdashboard.com', 'clientz5tWzoydVL',
    maxConnectionAttempts: 1);

/*

MqttBrowserClient mq = MqttBrowserClient('ws://test.mosquitto.org', 'client-1',
    maxConnectionAttempts: 1);

 */
class mqttService {
  final connMess = MqttConnectMessage()
      .withClientIdentifier('clientIdentifier')
      .withWillTopic('willtopic')
      .withWillMessage('My Will message')
      .startClean() // Non persistent session for testing
      .withWillQos(MqttQos.atLeastOnce);

  Future<MqttClientConnectionStatus?> connectToServer() async {
    try {
      mq.port = 8000;
      mq.keepAlivePeriod = 50;
      mq.connectionMessage = connMess;
      mq.websocketProtocols = MqttClientConstants.protocolsSingleDefault;

      var status = await mq.connect();
      return status;
    } catch (e) {
      print("error is " + e.toString());
      return null;
    }
  }
}

```

The error message I receive is

```auto
 The maximum allowed connection attempts ({1}) were exceeded. The broker is
not responding to the connection request message (Missing Connection Acknowledgement?

```

---

<div class="post-metadata">

**Author:** ![Daria\_H](https://avatars.discourse-cdn.com/v4/letter/d/dfb087/32.png) [@Daria\_H](https://community.hivemq.com/u/Daria_H)\
**Post date:** [June 17, 2022, 7:39am UTC](https://community.hivemq.com/t/hive-websocket-connection-failure/1217/2 "2022-06-17T07:39:40Z")

</div>

Hello @a14guguliye ,

Does it fail only for ‘ws://test.mosquitto.org’ or for any broker?

Thanks,  
Dasha
