You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@camel.apache.org by cameral <en...@126.com> on 2016/12/29 03:24:33 UTC

How to get response using AHC-WS

I was testing the function of a websocket server which supports  JSON RPC
2.0. The Chrome js client works correctly. But when I use AHC-WS  the
request returns directly, and I cannot find any post that can Help me to get
the server response. 


Can anyone help? 



--
View this message in context: http://camel.465427.n5.nabble.com/How-to-get-response-using-AHC-WS-tp5791985.html
Sent from the Camel - Users mailing list archive at Nabble.com.

Re: How to get response using AHC-WS

Posted by cameral <en...@126.com>.
Am I asking this wrong or this is too simple to answer?  What I am
experiencing is that after sending  AHC-ws exchange message, the next
producer's exchange message is still the input message not the server
response.

To reproduce this is:
1. setup a websocket server( Camel-websocket) in local machine. for example
ws://localhost:9999/demo
    		context.addRoutes(new RouteBuilder() {
			public void configure() {

				from("websocket://localhost:9999/demo/")
				.log("${body}")
				.setBody().simple("transormed informaton from:  ${body}")
				.log("${body}")
				.to("websocket://localhost:9999/demo/");
			}
		});
2. setup a ahc-ws client to connect the server and send a simple request
                context.addRoutes(new RouteBuilder() {
			public void configure() {

				from("stream:in?promptMessage=Input Your request to server: ")
				.to("ahc-ws://localhost:9999/demo/")
				.log("${body}")
				.to("file:record");
			}
		});
in the client command line input "common" to test, and logs shows :

Input Your request to server: common
2016-12-30 13:53:22,071 INFO [org.apache.camel.component.ahc.ws.WsEndpoint]
- Reconnecting websocket: ws://localhost:9999/demo/
2016-12-30 13:53:22,344 INFO [route1] - common
Input Your request to server: 

server side logs shows:
2016-12-30 13:53:22,366 INFO [route1] - common
2016-12-30 13:53:22,374 INFO [route1] - transormed informaton from:  common


So, what did I miss?



--
View this message in context: http://camel.465427.n5.nabble.com/How-to-get-response-using-AHC-WS-tp5791985p5792007.html
Sent from the Camel - Users mailing list archive at Nabble.com.