| .. | .. |
|---|
| 13 | 13 | this.mqttToken, |
|---|
| 14 | 14 | }); |
|---|
| 15 | 15 | |
|---|
| 16 | | - /// Primary WebSocket URL (local network). |
|---|
| 17 | | - String get localUrl { |
|---|
| 18 | | - final h = localHost ?? host; |
|---|
| 19 | | - return 'ws://$h:$port'; |
|---|
| 20 | | - } |
|---|
| 21 | | - |
|---|
| 22 | | - /// Fallback WebSocket URL (remote / public). |
|---|
| 23 | | - String get remoteUrl => 'ws://$host:$port'; |
|---|
| 24 | | - |
|---|
| 25 | | - /// Returns [localUrl, remoteUrl] for dual-connect attempts. |
|---|
| 26 | | - List<String> get urls { |
|---|
| 27 | | - if (localHost != null && localHost!.isNotEmpty && localHost != host) { |
|---|
| 28 | | - return [localUrl, remoteUrl]; |
|---|
| 29 | | - } |
|---|
| 30 | | - return [remoteUrl]; |
|---|
| 31 | | - } |
|---|
| 32 | | - |
|---|
| 33 | 16 | Map<String, dynamic> toJson() { |
|---|
| 34 | 17 | return { |
|---|
| 35 | 18 | 'host': host, |
|---|