Dart Documentationobjectory_server_implObjectoryServerImpl

ObjectoryServerImpl class

class ObjectoryServerImpl {
 Db db;
 String hostName;
 int port;
 String mongoUri;
 int _token = 0;
 String oauthClientId;
 ObjectoryServerImpl(this.hostName,this.port,this.mongoUri, bool verbose){
   hierarchicalLoggingEnabled = true;
   if (verbose) {
     _log.level = Level.ALL;
   }
   else {
     _log.level = Level.WARNING;
   }    
   db = new Db(mongoUri);
   db.open().then((_) {
     HttpServer.bind(hostName, port).then((server) {
       server.transform(new WebSocketTransformer()).listen((WebSocket webSocket) {
         _token+=1;
         var c = new ObjectoryClient(_token, webSocket, db);
         _log.fine('adding connection token = ${_token}');
      }, onError: (e) => _log.severe(e.toString()));
     }).catchError((e) => _log.severe(e.toString()));
   });
   print('Listening on http://$hostName:$port');
   print('MongoDB connection: ${db.serverConfig.host}:${db.serverConfig.port}');         
 }
}

Constructors

new ObjectoryServerImpl(String hostName, int port, String mongoUri, bool verbose) #

Creates a new Object instance.

Object instances have no meaningful state, and are only useful through their identity. An Object instance is equal to itself only.

docs inherited from Object
ObjectoryServerImpl(this.hostName,this.port,this.mongoUri, bool verbose){
 hierarchicalLoggingEnabled = true;
 if (verbose) {
   _log.level = Level.ALL;
 }
 else {
   _log.level = Level.WARNING;
 }    
 db = new Db(mongoUri);
 db.open().then((_) {
   HttpServer.bind(hostName, port).then((server) {
     server.transform(new WebSocketTransformer()).listen((WebSocket webSocket) {
       _token+=1;
       var c = new ObjectoryClient(_token, webSocket, db);
       _log.fine('adding connection token = ${_token}');
    }, onError: (e) => _log.severe(e.toString()));
   }).catchError((e) => _log.severe(e.toString()));
 });
 print('Listening on http://$hostName:$port');
 print('MongoDB connection: ${db.serverConfig.host}:${db.serverConfig.port}');         
}

Properties

Db db #

Db db

String hostName #

String hostName

String mongoUri #

String mongoUri

String oauthClientId #

String oauthClientId

int port #

int port