Java 在c#客户端中使用Spring Boot Sockjs
Java 在c#客户端中使用Spring Boot Sockjs,java,c#,spring,spring-mvc,stomp,Java,C#,Spring,Spring Mvc,Stomp,我正在尝试使用STOMP和websockets将c#应用程序连接到spring Boot应用程序。我在NMS中有以下测试代码,每次尝试连接到web应用程序时,我都会遇到连接关闭异常 // Example connection strings: // activemq:tcp://activemqhost:61616 // stomp:tcp://activemqhost:61613 // ems:tcp://tibcohost:
我正在尝试使用STOMP和websockets将c#应用程序连接到spring Boot应用程序。我在NMS中有以下测试代码,每次尝试连接到web应用程序时,我都会遇到连接关闭异常
// Example connection strings:
// activemq:tcp://activemqhost:61616
// stomp:tcp://activemqhost:61613
// ems:tcp://tibcohost:7222
// msmq://localhost
Uri connecturi = new Uri("stomp:tcp://localhost:8080/hello");
Console.WriteLine("About to connect to " + connecturi);
// NOTE: ensure the nmsprovider-activemq.config file exists in the executable folder.
IConnectionFactory factory = new NMSConnectionFactory(connecturi);
using (IConnection connection = factory.CreateConnection())
using (ISession session = connection.CreateSession())
{
// Examples for getting a destination:
//
// Hard coded destinations:
// IDestination destination = session.GetQueue("FOO.BAR");
// Debug.Assert(destination is IQueue);
// IDestination destination = session.GetTopic("FOO.BAR");
// Debug.Assert(destination is ITopic);
//
// Embedded destination type in the name:
// IDestination destination = SessionUtil.GetDestination(session, "queue://FOO.BAR");
// Debug.Assert(destination is IQueue);
// IDestination destination = SessionUtil.GetDestination(session, "topic://FOO.BAR");
// Debug.Assert(destination is ITopic);
//
// Defaults to queue if type is not specified:
IDestination destination = SessionUtil.GetDestination(session, "Presence");
Console.WriteLine("Using destination: " + destination);
// Create a consumer and producer
using (IMessageConsumer consumer = session.CreateConsumer(destination))
using (IMessageProducer producer = session.CreateProducer(destination))
{
或者我应该使用其他方法来实现这一点,我只需要从SpringBootWeb应用程序向c#桌面应用程序发送一些推送通知