Connect to correct host. Refactor some code.
This commit is contained in:
parent
2ad028f8a7
commit
23f6a6b14c
@ -19,7 +19,7 @@ class ChessApp extends StatelessWidget {
|
||||
child: BlocProvider(
|
||||
create: (_) => ChessBloc.getInstance(),
|
||||
child: MaterialApp(
|
||||
title: 'mChess',
|
||||
title: 'mChess v0.1.10',
|
||||
home: Scaffold(
|
||||
body: Container(
|
||||
decoration: const BoxDecoration(
|
||||
|
@ -7,7 +7,7 @@ import 'package:mchess/chess_bloc/chess_bloc.dart';
|
||||
import '../connection/ws_connection.dart';
|
||||
import 'chess_utils.dart';
|
||||
|
||||
int message_index = 0;
|
||||
int messageIndex = 0;
|
||||
|
||||
class ChessSquare extends StatelessWidget {
|
||||
final ChessCoordinate coordinate;
|
||||
@ -90,7 +90,7 @@ class ChessSquare extends StatelessWidget {
|
||||
|
||||
if (move.endSquare != move.startSquare) {
|
||||
ServerConnection.getInstance().send(
|
||||
'${message_index++} mv ${move.startSquare.toString()} ${move.endSquare.toString()}');
|
||||
'${messageIndex++} mv ${move.startSquare.toString()} ${move.endSquare.toString()}');
|
||||
|
||||
context.read<ChessBloc>().add(
|
||||
PieceMoved(
|
||||
|
@ -14,7 +14,7 @@ class ServerConnection {
|
||||
static final ServerConnection _instance = ServerConnection._internal();
|
||||
|
||||
ServerConnection._internal() {
|
||||
log("ServerConnection._interal constructor is called");
|
||||
log("ServerConnection._internal constructor is called");
|
||||
connect();
|
||||
}
|
||||
|
||||
@ -33,7 +33,10 @@ class ServerConnection {
|
||||
|
||||
void connect() {
|
||||
if (wasConnected) channel.sink.close();
|
||||
channel = WebSocketChannel.connect(Uri.parse('ws://localhost:8080'));
|
||||
channel =
|
||||
WebSocketChannel.connect(Uri.parse('wss://chess.sw-gross.de:8080'));
|
||||
log(channel.closeCode.toString());
|
||||
|
||||
wasConnected = true;
|
||||
|
||||
broadcast = channel.stream.asBroadcastStream();
|
||||
|
Loading…
Reference in New Issue
Block a user