Exemplo n.º 1
0
 private void InitMessageHandler(WebSocketConnection ws)
 {
     ws.OnMessage = async(data) =>
     {
         _log($"[Received message]: {data}");
         await ws.SendAsync(await _messageResolver.Resolve(data, ws));
     };
 }
Exemplo n.º 2
0
        static async Task Main(string[] args)
        {
            CultureInfo.CurrentCulture = CultureInfo.InvariantCulture;

            Action <string> consoleLog = Console.WriteLine;

            timeTracker = new TimeTracker();

            stockUpdater = new StockUpdater();

            stockUpdater.Subscribe(timeTracker, UpdateStock);

            vinylTracker = new VinylTracker();

            vinylObserver = new VinylObserver();

            vinylObserver.Subscribe(vinylTracker, (x) => { _ = CurrentConnection.SendAsync(MessageParser.Create("OnNext", x, x.GetType().Name)); });

            await CreateServer();
        }