You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@camel.apache.org by "Ton Swieb (JIRA)" <ji...@apache.org> on 2015/11/21 21:41:10 UTC

[jira] [Created] (CAMEL-9348) Endpoints for the same websocket with different parameters cannot send message to websocket client

Ton Swieb created CAMEL-9348:
--------------------------------

             Summary: 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.15.4, 2.16.0, 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)