camel-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Ton Swieb <...@finalist.nl>
Subject Unable to echo back the message to a client using websocket
Date Fri, 20 Nov 2015 13:50:17 GMT
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

Mime
  • Unnamed multipart/alternative (inline, None, 0 bytes)
View raw message