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(); } }
/// <summary> /// Connects this instance. /// </summary> public void Connect() { Disconnect(); Log.Debug("Sending 'CONNECT' to server"); _stompClient.Connect(); }
public void Setup() { var inMemoryListener = new StompInMemoryListener(); _server = new StompServer(inMemoryListener); _client1 = new StompClient(new InMemoryTransport(inMemoryListener)); _server.Start(); _client1.Connect(); }
/// <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; }
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(); }
/// <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; })); }
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(); }
private void btnConnect_Click(object sender, EventArgs e) { client.Connect(); }