[
https://issues.apache.org/jira/browse/CAMEL-9348?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=15020703#comment-15020703
]
ASF GitHub Bot commented on CAMEL-9348:
---------------------------------------
GitHub user tonswieb opened a pull request:
https://github.com/apache/camel/pull/689
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-2.15.x
Alternatively you can review and apply these changes as the patch at:
https://github.com/apache/camel/pull/689.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 #689
----
commit 288c6d63999adf231d9aba6569aa67cafccf8081
Author: Ton Swieb <[email protected]>
Date: 2015-11-21T20:44:30Z
Moved WebSocketStore and NodeSynchronization from the Endpoint to the
Connector
Conflicts:
components/camel-websocket/src/main/java/org/apache/camel/component/websocket/WebsocketComponent.java
components/camel-websocket/src/main/java/org/apache/camel/component/websocket/WebsocketEndpoint.java
----
> 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
> Fix For: 2.17.0
>
>
> 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)