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; } }
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}"); } }
public static Well GetWell(DataWellSettings settings, TransportTypes transportType) { return(new Well(settings, transportType)); }