Example #1
0
        //static JsonClientChannel Channel = new JsonClientChannel();

        static async Task Main(string[] args)
        {
            Console.WriteLine("Press Enter to Connect");
            Console.ReadLine( );

            var messageDispatcher = new XDocumentMessageDispatcher();

            //var messageDispatcher = new JsonMessageDispatcher();
            messageDispatcher.Bind <MessageHandler>( );

            //messageDispatcher.Register<HeartBeatResponseMessage>( MessageHandler.HandleMessage );
            //messageDispatcher.Register<SubmitBasketResponse>( MessageHandler.HandleMessage );


            var endpoint = new IPEndPoint(IPAddress.Loopback, 9000);

            messageDispatcher.Bind(Channel);
            await Channel.ConnectAsync(endpoint).ConfigureAwait(false);

            _ = Task.Run(HBLoop);

            var basket = new SubmitBasketRequest {
                Id      = "TXN0007",
                POSData = new POSData {
                    Id = "POS001 "
                }
            };
            await Channel.SendAsync(basket).ConfigureAwait(false);

            Console.ReadLine( );
        }
Example #2
0
        //readonly JsonMessageDispatcher _messageDispatcher = new JsonMessageDispatcher();

        public SocketServer( )
        {
            //_messageDispatcher.Register<HeartBeatRequestMessage, HeartBeatResponseMessage>( MessageHandler.HandleMessage );
            //_messageDispatcher.Register<SubmitBasketRequest, SubmitBasketResponse>( MessageHandler.HandleMessage );
            _messageDispatcher.Bind <MessageHandler>( );
        }