Could you try having an echo2 channel or something so you don't use the same as you received from, to see if that works?
On Fri, Nov 20, 2015 at 2:50 PM, Ton Swieb <[email protected]> wrote: > Hi, > > I am trying to setup a websocket using Camel 2.16.0 that echo's back > everything it receives. > I had a look at http://camel.apache.org/websocket.html and something like: > from("websocket://echo") > .log(">>> Message received from WebSocket Client : ${body}") > .transform().simple("${body}${body}") > // send back to the client, by sending the message to the same endpoint > // this is needed as by default messages is InOnly > // and we will by default send back to the current client using the > provided connection key > .to("websocket://echo"); > > should do the trick. > > So I setup something similar but it does not give back any response to the > websocket client. > I only get a response when I use the sendToAll flag. > > > Should I configure something additionally? > > My example project is at: > https://github.com/tonswieb/camel-websocket-example/ > Which can be run using camel:run after which you can pen a session from > your browser by goging to http://localhost:9292/ > > When I send something from the browser I see in the logging that it is send > back by the websocketproducer, but nothing shows at client side. > Periodically broadcasting messages from Camel to the client works as > expected. So when the sendToAll flag is used. > > The following is shown in the logging: > DEBUG | DefaultWebsocket | onMessage > | onMessage: Test > INFO | route2 | info > | Received: Test from acf89a8a-e89a-4fee-8fb4-d6a3341df59b > DEBUG | SendProcessor | process > | >>>> Endpoint[websocket://camel-tweet?staticResources=classpath%3Awebapp] > Exchange[ID-MacBook-Pro-van-Ton-local-56803-1448027164258-0-6][Message: > Test from acf89a8a-e89a-4fee-8fb4-d6a3341df59b] > DEBUG | WebsocketProducer | process > | Sending to connection key acf89a8a-e89a-4fee-8fb4-d6a3341df59b -> Test > from acf89a8a-e89a-4fee-8fb4-d6a3341df59b > > Kind regards, > > Ton -- Claus Ibsen ----------------- http://davsclaus.com @davsclaus Camel in Action 2: https://www.manning.com/ibsen2
