예제 #1
0
 public WSServerTransport(DataWellSettings settings)
 {
     try
     {
         _webSocket = new WebSocketServer($"ws://{settings.Host}:{settings.Port}");
         _webSocket.AddWebSocketService <DataWellWSService>("/DataWell", () => new DataWellWSService(new DataWellServer()));
         _webSocket.Start();
     }
     catch (Exception e)
     {
         Console.WriteLine(e);
         throw;
     }
 }
예제 #2
0
        private Well(DataWellSettings settings, TransportTypes transportType)
        {
            _settings = DataEnvironment.DataWellSettings = settings;
            _storage  = DataEnvironment.MemStorage = new MemStorage();
            try
            {
                switch (transportType)
                {
                case TransportTypes.WebSocket:
                    _serverTransport = new WSServerTransport(settings);
                    break;

                case TransportTypes.Http:
                    throw new NotImplementedException();
                    break;

                default: break;
                }
            }
            catch (Exception e)
            {
                throw new Exception($"Well GetWell Error: {e.Message}");
            }
        }
예제 #3
0
 public static Well GetWell(DataWellSettings settings, TransportTypes transportType)
 {
     return(new Well(settings, transportType));
 }