Beispiel #1
0
        public static void Main(string[] args)
        {
            var endPoint = new IPEndPoint(IPAddress.Parse("127.0.0.1"), 5467);
            var parser   = new StompParser();

            using (var reStompService = new StompService(endPoint, parser))
            {
                reStompService.Start((middlewareStack) =>
                {
                    middlewareStack.Push(new TerminationMiddleware().Invoke);
                    middlewareStack.Push(new ProtocolVersionMiddleware().Invoke);
                    middlewareStack.Push(new SessionMiddleware().Invoke);
                    middlewareStack.Push(new SendMiddleware().Invoke);
                });

                Console.WriteLine("Service started.");

                var client = new StompClient();

                var session = client.Connect("127.0.0.1", 5467).Result;

                if (session != null)
                {
                    client.Send(new Dictionary <string, string> {
                        ["receipt-id"] = "111"
                    }, "WOO!").Wait();
                }

                Console.ReadLine();
            }
        }
Beispiel #2
0
        /// <summary>
        /// Connects this instance.
        /// </summary>
        public void Connect()
        {
            Disconnect();

            Log.Debug("Sending 'CONNECT' to server");
            _stompClient.Connect();
        }
Beispiel #3
0
        public void Setup()
        {
            var inMemoryListener = new StompInMemoryListener();
            _server = new StompServer(inMemoryListener);
            _client1 = new StompClient(new InMemoryTransport(inMemoryListener));

            _server.Start();
            _client1.Connect();
        }
Beispiel #4
0
        /// <summary>
        ///     Connect to STOMP Server.  If the connection fails all resources are closed.
        /// </summary>
        private void Connect(string token)
        {
            if (!_stomp.Connect(token, token))
            {
                throw new SecucardConnectException();
            }

            _connectToken = token;
        }
Beispiel #5
0
        public void Setup()
        {
            var inMemoryListener = new StompInMemoryListener();

            _server  = new StompServer(inMemoryListener);
            _client1 = new StompClient(new InMemoryTransport(inMemoryListener));

            _server.Start();
            _client1.Connect();
        }
        public void Setup()
        {
            const string pipeName = "ws://localhost:8080/";

            _server = new StompServer(new StompWebsocketListener(pipeName));
            _client = new StompClient(new WebTransportTransport(pipeName));

            _server.Start();
            _client.Connect();
        }
Beispiel #7
0
        public void Setup()
        {
            const string pipeName = "ws://localhost:8080/";

            _server = new StompServer(new StompWebsocketListener(pipeName));
            _client = new StompClient(new WebTransportTransport(pipeName));

            _server.Start();
            _client.Connect();
        }
        public void Setup()
        {
            var inMemoryListener = new StompInMemoryListener();
            var wsListener = new StompWebsocketListener("ws://localhost:8080/");

            _server = new StompServer(inMemoryListener, wsListener);
            _client1 = new StompClient(new InMemoryTransport(inMemoryListener));
            _client2 = new StompClient(new WebTransportTransport("ws://localhost:8080/"));

            _server.Start();

            _client1.Connect();
            _client2.Connect();
        }
Beispiel #9
0
        public void Setup()
        {
            var inMemoryListener = new StompInMemoryListener();
            var wsListener       = new StompWebsocketListener("ws://localhost:8080/");

            _server  = new StompServer(inMemoryListener, wsListener);
            _client1 = new StompClient(new InMemoryTransport(inMemoryListener));
            _client2 = new StompClient(new WebTransportTransport("ws://localhost:8080/"));

            _server.Start();

            _client1.Connect();
            _client2.Connect();
        }
        /// <summary>
        ///   Gets the connection.
        /// </summary>
        /// <param name = "address">The address.</param>
        /// <returns></returns>
        private StompClient GetConnection(IEndpointAddress address)
        {
            EnsureProtocolIsCorrect(address.Uri);

            var serverAddress = new UriBuilder("ws", address.Uri.Host, address.Uri.Port).Uri;

            return(_connectionCache
                   .Retrieve(address.Uri,
                             () =>
            {
                var client = new StompClient();
                client.Connect(serverAddress);
                return client;
            }));
        }
Beispiel #11
0
        private static void Main(string[] args)
        {
            const string address    = "ws://localhost:8181/";
            var          wsListener = new StompWebsocketListener(address);

            wsListener.OnConnect
                += stompClient =>
                {
                Console.WriteLine("a new client connected!");
                stompClient.OnMessage += msg => Console.Out.WriteLine("msg received: {0} {1}", msg.Command, msg.Body);
                };

            var server = new StompServer(wsListener);

            server.Start();

            var client = new StompClient(new WebTransportTransport(address));

            client.Connect();
            client.Send("/queue/test", "hi there. you are the first to connect");

            Console.Out.WriteLine("Press [Enter] to stop the server");
            Console.ReadLine();
        }
Beispiel #12
0
 private void btnConnect_Click(object sender, EventArgs e)
 {
     client.Connect();
 }