Skip to content

Commit

Permalink
Initial http client implementation
Browse files Browse the repository at this point in the history
  • Loading branch information
Adriano Santos committed Oct 20, 2023
1 parent 792d9a6 commit 58018cd
Show file tree
Hide file tree
Showing 2 changed files with 35 additions and 5 deletions.
5 changes: 0 additions & 5 deletions lib/src/service.dart
Original file line number Diff line number Diff line change
Expand Up @@ -18,11 +18,6 @@ class Service {
'content-type': 'application/octet-stream',
};

final _dartVersion = () {
final version = Platform.version;
return version.substring(0, version.indexOf(' '));
}();

late String spawnSystem;
late Map<String, ActorHandler> spawnActorHandlers;

Expand Down
35 changes: 35 additions & 0 deletions lib/src/spawn_client.dart
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
import 'dart:io';

import 'package:spawn_dart/src/actor_handler.dart';

class SpawnClient {
static final _client = HttpClient();
static final _dartVersion = () {
final version = Platform.version;
return version.substring(0, version.indexOf(' '));
}();
static final String _registerUrlPath = "/api/v1/system";
Map<String, ActorHandler> _actorHandlers = {};

String _proxyHost = Platform.environment["PROXY_HTTP_HOST"] ?? "0.0.0.0";
int _proxyPort = int.parse(Platform.environment["PROXY_HTTP_PORT"] ?? "9001");

SpawnClient(Map<String, ActorHandler> actorHandlers) {
_actorHandlers = actorHandlers;
}

SpawnClient.withConnectionParams(
String host, int port, Map<String, ActorHandler> actorHandlers) {
_proxyHost = host;
_proxyPort = port;
_actorHandlers = actorHandlers;
}

String get proxyHost {
return _proxyHost;
}

int get proxyPort {
return _proxyPort;
}
}

0 comments on commit 58018cd

Please sign in to comment.