Connect to localhost if in debug mode.

This commit is contained in:
Marco 2022-12-18 23:06:55 +01:00
parent 9128bb1cbb
commit c9a93dd167

View File

@ -1,6 +1,7 @@
import 'dart:developer'; import 'dart:developer';
import 'dart:io'; import 'dart:io';
import 'package:flutter/foundation.dart';
import 'package:mchess/chess_bloc/chess_bloc.dart'; import 'package:mchess/chess_bloc/chess_bloc.dart';
import 'package:mchess/chess_bloc/chess_events.dart'; import 'package:mchess/chess_bloc/chess_events.dart';
import 'package:mchess/chessapp/chess_utils.dart'; import 'package:mchess/chessapp/chess_utils.dart';
@ -35,8 +36,12 @@ class ServerConnection {
void connect() { void connect() {
if (wasConnected) channel.sink.close(); if (wasConnected) channel.sink.close();
channel = if (kDebugMode) {
WebSocketChannel.connect(Uri.parse('wss://chess.sw-gross.de:8080')); channel = WebSocketChannel.connect(Uri.parse('ws://localhost:8080'));
} else {
channel =
WebSocketChannel.connect(Uri.parse('wss://chess.sw-gross.de:8080'));
}
log(channel.closeCode.toString()); log(channel.closeCode.toString());