| .. | .. |
|---|
| 14 | 14 | import '../providers/providers.dart'; |
|---|
| 15 | 15 | import '../services/audio_service.dart'; |
|---|
| 16 | 16 | import '../services/message_store.dart'; |
|---|
| 17 | | -import '../services/websocket_service.dart'; |
|---|
| 17 | +import '../services/mqtt_service.dart'; |
|---|
| 18 | 18 | import '../theme/app_theme.dart'; |
|---|
| 19 | 19 | import '../widgets/command_bar.dart'; |
|---|
| 20 | 20 | import '../widgets/input_bar.dart'; |
|---|
| .. | .. |
|---|
| 34 | 34 | |
|---|
| 35 | 35 | class _ChatScreenState extends ConsumerState<ChatScreen> |
|---|
| 36 | 36 | with WidgetsBindingObserver { |
|---|
| 37 | | - WebSocketService? _ws; |
|---|
| 37 | + MqttService? _ws; |
|---|
| 38 | 38 | final TextEditingController _textController = TextEditingController(); |
|---|
| 39 | 39 | final ScrollController _scrollController = ScrollController(); |
|---|
| 40 | 40 | final GlobalKey<ScaffoldState> _scaffoldKey = GlobalKey<ScaffoldState>(); |
|---|
| .. | .. |
|---|
| 125 | 125 | if (config == null) return; |
|---|
| 126 | 126 | } |
|---|
| 127 | 127 | |
|---|
| 128 | | - _ws = WebSocketService(config: config); |
|---|
| 128 | + _ws = MqttService(config: config); |
|---|
| 129 | 129 | _ws!.onStatusChanged = (status) { |
|---|
| 130 | 130 | if (mounted) { |
|---|
| 131 | 131 | ref.read(wsStatusProvider.notifier).state = status; |
|---|
| .. | .. |
|---|
| 135 | 135 | _ws!.onOpen = () { |
|---|
| 136 | 136 | final activeId = ref.read(activeSessionIdProvider); |
|---|
| 137 | 137 | _sendCommand('sync', activeId != null ? {'activeSessionId': activeId} : null); |
|---|
| 138 | + // catch_up is still available during the transition period |
|---|
| 138 | 139 | _sendCommand('catch_up', {'lastSeq': _lastSeq}); |
|---|
| 139 | 140 | }; |
|---|
| 140 | 141 | _ws!.onError = (error) { |
|---|
| 141 | | - debugPrint('WS error: $error'); |
|---|
| 142 | + debugPrint('MQTT error: $error'); |
|---|
| 142 | 143 | }; |
|---|
| 143 | 144 | |
|---|
| 144 | 145 | NavigateNotifier.instance = NavigateNotifier( |
|---|