Connect to localhost when I am on my dev environment.

This commit is contained in:
Marco 2022-12-18 15:54:19 +01:00
parent 23f6a6b14c
commit 31faabcf94

View File

@ -1,4 +1,5 @@
import 'dart:developer';
import 'dart:io';
import 'package:mchess/chess_bloc/chess_bloc.dart';
import 'package:mchess/chess_bloc/chess_events.dart';
@ -33,8 +34,13 @@ class ServerConnection {
void connect() {
if (wasConnected) channel.sink.close();
if (Platform.localHostname == 'mbook') {
// My test environment
channel = WebSocketChannel.connect(Uri.parse('ws://localhost:8080'));
} else {
channel =
WebSocketChannel.connect(Uri.parse('wss://chess.sw-gross.de:8080'));
}
log(channel.closeCode.toString());
wasConnected = true;