camel-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Claus Ibsen <claus.ib...@gmail.com>
Subject Re: Unable to echo back the message to a client using websocket
Date Sun, 22 Nov 2015 08:27:35 GMT
Hi

Thanks a lot.

There is 3 PR's for this.
Which one should we use? I assume it would be pull 690 which has the
highest number?

If so can you close the other 2, so there is only 1 PR open.



On Sat, Nov 21, 2015 at 11:10 PM, Ton Swieb <ton@finalist.nl> wrote:
> Hi Claus,
>
> The problem was caused by the two websocket producer endpoints having a
> different parameter set. When I keep the websocket producer endpoints the
> same and use the header WebsocketConstants.SEND_TO_ALL for broadcasting
> then everything works OK. As soon as I use the sendToAll parameter in one
> of the producer URI's then the endpoints are different and only the first
> route will work.
> I created https://issues.apache.org/jira/browse/CAMEL-9348 with a pull
> request.
>
> Regards,
>
> Ton
>
> 2015-11-21 9:45 GMT+01:00 Claus Ibsen <claus.ibsen@gmail.com>:
>
>> 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 <ton@finalist.nl> 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
>>



-- 
Claus Ibsen
-----------------
http://davsclaus.com @davsclaus
Camel in Action 2: https://www.manning.com/ibsen2

Mime
View raw message