shamblett / mqtt5_client

A server and browser based MQTT 5 client for dart
Other
49 stars 25 forks source link

how to use MqttBrowserClient #95

Closed xBLACKICEx closed 3 months ago

xBLACKICEx commented 3 months ago

how to connect mqtt server in browser ?

i can't connect to any mqtt server like using wss hive.cloud or emqx.com with MqttBrowserClient

the mobile side works fine. for me with MqttServerClient client.secure and client.securityContext settings.

What am I doing wrong? What step am I missing on Browser version?

图片 图片 图片

shamblett commented 3 months ago

Try removing your websocket protocols setting, or setting it to []. Check your port is correct.

Check your broker logs as to why its refusing the connection.

xBLACKICEx commented 3 months ago

i found the problem need add mqtt at the end hostname, some thing like this:

MqttBrowserClient.witport(
"wss://xxx/mqtt",
"flutterclientid",
8884
)