Jetty websocket client connect to Stomp.js topic channel -
i have written spring websocket server assessible browser via stomp.js. attempting implement java client in order connect server secondary system. able connect server using following code
string desturi = "ws://localhost:8080/sample"; websocketclient client = new websocketclient(); simpleechosocket socket = new simpleechosocket(); try { client.start(); uri echouri = new uri(desturi); clientupgraderequest request = new clientupgraderequest(); client.connect(socket, echouri, request); system.out.printf("connecting : %s%n", echouri); socket.awaitclose(5, timeunit.seconds); } catch (throwable t) { t.printstacktrace(); }
the connection opened, , connect topic /price-stream. achieved stomp.js :
stompclient.subscribe('/topic/pricechannel1', renderprice);
what equivalent subscribe method jetty websocket client? cant find in documentation have found on net.
additional info:
i trying implement stockticker example found here project. can connect server through provided stomp.js interface in web browser. attempting create java client use within swing gui using jetty websocket-client connect.
i need connect price stream, seems missing kind of configuration request latch on destination topic
in general, plain websocket clients (as 1 provided jetty) support websocket standard. stomp protocol sits on top of transport.
here, you'd need implement own stomp client or interface existing 1 websocket client you're using.
spring 4.2 (to published soon) includes new stomp client particular use case. see reference documentation of 4.2.rc2.
Comments
Post a Comment