You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@camel.apache.org by "ASF GitHub Bot (JIRA)" <ji...@apache.org> on 2015/11/21 21:48:11 UTC
[jira] [Commented] (CAMEL-9348) Endpoints for the same websocket
with different parameters cannot send message to websocket client
[ https://issues.apache.org/jira/browse/CAMEL-9348?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=15020685#comment-15020685 ]
ASF GitHub Bot commented on CAMEL-9348:
---------------------------------------
GitHub user tonswieb opened a pull request:
https://github.com/apache/camel/pull/688
Moved WebSocketStore and NodeSynchronization from the Endpoint to theā¦
https://issues.apache.org/jira/browse/CAMEL-9348
You can merge this pull request into a Git repository by running:
$ git pull https://github.com/tonswieb/camel CAMEL-9348
Alternatively you can review and apply these changes as the patch at:
https://github.com/apache/camel/pull/688.patch
To close this pull request, make a commit to your master/trunk branch
with (at least) the following in the commit message:
This closes #688
----
commit 8a65a5d1db3332ceb6ad5fb658c3d54a202b2db1
Author: Ton Swieb <to...@finalist.nl>
Date: 2015-11-21T20:44:30Z
Moved WebSocketStore and NodeSynchronization from the Endpoint to the Connector
----
> Endpoints for the same websocket with different parameters cannot send message to websocket client
> --------------------------------------------------------------------------------------------------
>
> Key: CAMEL-9348
> URL: https://issues.apache.org/jira/browse/CAMEL-9348
> Project: Camel
> Issue Type: Bug
> Components: camel-websocket
> Affects Versions: 2.16.0, 2.15.4, 2.17.0
> Reporter: Ton Swieb
>
> Having multiple routes with the same websocket consumer/producer causes only the first route to initialize correctly when the endpoint parameters are different per used consumer/producer endpoint URI.
> In the following example only the first route to register the websocket endpoint will work. The second route will not work.
> {code}
> from("websocket://localhost:" + port + "/bar")
> .transform().simple("The bar has ${body}")
> .to("websocket://localhost:" + port + "/bar");
> from("timer://foo?fixedRate=true&period=12000")
> .setBody(constant("Broadcasting to Bar"))
> .to("websocket://localhost:" + port + "/bar?sendToAll=true");
> {code}
> When the endpoint parameters are the same and a header value is used for broadcasting then both routes will work as expected:
> {code}
> from("websocket://localhost:" + port + "/bar")
> .transform().simple("The bar has ${body}")
> .to("websocket://localhost:" + port + "/bar");
> from("timer://foo?fixedRate=true&period=12000")
> .setBody(constant("Broadcasting to Bar"))
> .setHeader(WebsocketConstants.SEND_TO_ALL,constant(true))
> .to("websocket://localhost:" + port + "/bar");
> {code}
> The NodeSynchronization / WebSocketStore which contains all registered clients is maintained per endpoint and only the NodeSynchronization of the 1st registered endpoint is linked to the WeboscketServlet. The NodeSynchronization of all subsequent endpoints are not linked to the WebsocketServlet and are unaware of the connected websocket clients.
> The endpoints URI /bar and /bar?sendToAll=true are treated as different endpoints, but belong to the same websocket.
> I created a fix and will make a PR for it.
--
This message was sent by Atlassian JIRA
(v6.3.4#6332)