agones 1.28.0 copy "agones: ^1.28.0" to clipboard
agones: ^1.28.0 copied to clipboard

gRPC generated client for Agones - a library for hosting, running and scaling dedicated game servers on Kubernetes.

example/agones.dart

import 'package:agones/agones.dart';
import 'package:grpc/grpc.dart';
import 'package:collection/collection.dart';

void main(List<String> arguments) async {
  if (arguments.isEmpty) {
    throw Exception('Port argument required. Specify with `--port=YOUR_PORT`.');
  }
  final port = parseArguments(arguments);
  if (port is! int) {
    throw Exception('Invalid port specified.');
  }

  print('Connecting to localhost on Port: $port.');

  final sdkClient = SDKClient(ClientChannel('localhost',
      port: port,
      // You should not use the insecure mode in a production environment.
      options: ChannelOptions(credentials: ChannelCredentials.insecure())));

  // Hang & log responses to stdout.
  await for (final value in sdkClient.watchGameServer(Empty())) {
    print(value.toString());
  }

  print('Finished.');
}

const pattern = '--port=';
int? parseArguments(List<String> arguments) {
  final match =
      arguments.firstWhereOrNull((element) => element.startsWith(pattern));
  if (match == null) return null;

  return int.tryParse(match.split(pattern).last);
}
1
likes
120
pub points
0%
popularity

Publisher

verified publishermarkvideon.dev

gRPC generated client for Agones - a library for hosting, running and scaling dedicated game servers on Kubernetes.

Homepage

Documentation

API reference

License

BSD-3-Clause (LICENSE)

Dependencies

collection, fixnum, grpc, protobuf

More

Packages that depend on agones