You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@camel.apache.org by Deven Phillips <de...@gmail.com> on 2016/03/15 18:23:02 UTC
WebSockets and request parameters
Hi all,
We are using WebSockets for some our inter-service communications and I
am working to replace some legacy code with some Camel routes, but I am
running into a problem of needs some functionality which is not currently
present in Camel.
The 2 main features I am looking for and I am willing to implement are as
follows:
1. On initial connection of a new client to the websocket endpoint, I'd
like to be able to send a message telling the client about the server's
capabilities
2. When the client first connects, it used a request parameter (i.e.
?for=purpose) in the initial UPGRADE request and I need to capture those
values (preferably as headers on the Exchange)
Could anyone point me in the right direction for where to look so that I
can implement these changes in the WebSocket module? I know that there are
several implementations (Jetty/AHC/etc..), so I assume that it will need to
be implemented in all of them.
Thanks in advance!!
Deven
Re: WebSockets and request parameters
Posted by Deven Phillips <de...@gmail.com>.
I have started the work to prepare some PRs to implement these changes, but
I think that I would like some feedback on my approach..
Currently, I am thinking that a parameter `passRequest` could be set such
that when a message is processed in an Exchange it would have the
HttpServletRequest object attached as a header to the Exchange. I have this
code written and working, but I wanted to see if there were any objections
to this approach.
Secondly, I am implementing another parameter `messageOnConnect` which will
be a string passed into the Exchange on the start of a connection (client
or server). This will allow for logic that when a new websocket connection
is established, there can be an event processed.
Please feel free to comment or contribute suggestions before I get too far
along. I'm currently working on the unit tests for the aforementioned
features, so I hope to have it all completed soon.
Cheers,
Deven
On Thu, Mar 17, 2016 at 8:09 AM, Deven Phillips <de...@gmail.com>
wrote:
> Claus,
>
> Thanks for the information... I will get in there and try to get it
> done this weekend.
>
> Cheers,
>
> Deven
>
> On Thu, Mar 17, 2016 at 3:46 AM, Claus Ibsen <cl...@gmail.com>
> wrote:
>
>> Yeah
>>
>> Feel free to dive into the source code, there are 3 ws modules
>>
>> camel-websocket
>> camel-ahc-ws
>> amel-atmosphere-websocket
>>
>>
>>
>> On Tue, Mar 15, 2016 at 6:23 PM, Deven Phillips
>> <de...@gmail.com> wrote:
>> > Hi all,
>> >
>> > We are using WebSockets for some our inter-service communications
>> and I
>> > am working to replace some legacy code with some Camel routes, but I am
>> > running into a problem of needs some functionality which is not
>> currently
>> > present in Camel.
>> >
>> > The 2 main features I am looking for and I am willing to implement are
>> as
>> > follows:
>> >
>> >
>> > 1. On initial connection of a new client to the websocket endpoint,
>> I'd
>> > like to be able to send a message telling the client about the
>> server's
>> > capabilities
>> > 2. When the client first connects, it used a request parameter (i.e.
>> > ?for=purpose) in the initial UPGRADE request and I need to capture
>> those
>> > values (preferably as headers on the Exchange)
>> >
>> > Could anyone point me in the right direction for where to look so that I
>> > can implement these changes in the WebSocket module? I know that there
>> are
>> > several implementations (Jetty/AHC/etc..), so I assume that it will
>> need to
>> > be implemented in all of them.
>> >
>> > Thanks in advance!!
>> >
>> > Deven
>>
>>
>>
>> --
>> Claus Ibsen
>> -----------------
>> http://davsclaus.com @davsclaus
>> Camel in Action 2: https://www.manning.com/ibsen2
>>
>
>
Re: WebSockets and request parameters
Posted by Deven Phillips <de...@gmail.com>.
I have started the work to prepare some PRs to implement these changes, but
I think that I would like some feedback on my approach..
Currently, I am thinking that a parameter `passRequest` could be set such
that when a message is processed in an Exchange it would have the
HttpServletRequest object attached as a header to the Exchange. I have this
code written and working, but I wanted to see if there were any objections
to this approach.
Secondly, I am implementing another parameter `messageOnConnect` which will
be a string passed into the Exchange on the start of a connection (client
or server). This will allow for logic that when a new websocket connection
is established, there can be an event processed.
Please feel free to comment or contribute suggestions before I get too far
along. I'm currently working on the unit tests for the aforementioned
features, so I hope to have it all completed soon.
Cheers,
Deven
On Thu, Mar 17, 2016 at 8:09 AM, Deven Phillips <de...@gmail.com>
wrote:
> Claus,
>
> Thanks for the information... I will get in there and try to get it
> done this weekend.
>
> Cheers,
>
> Deven
>
> On Thu, Mar 17, 2016 at 3:46 AM, Claus Ibsen <cl...@gmail.com>
> wrote:
>
>> Yeah
>>
>> Feel free to dive into the source code, there are 3 ws modules
>>
>> camel-websocket
>> camel-ahc-ws
>> amel-atmosphere-websocket
>>
>>
>>
>> On Tue, Mar 15, 2016 at 6:23 PM, Deven Phillips
>> <de...@gmail.com> wrote:
>> > Hi all,
>> >
>> > We are using WebSockets for some our inter-service communications
>> and I
>> > am working to replace some legacy code with some Camel routes, but I am
>> > running into a problem of needs some functionality which is not
>> currently
>> > present in Camel.
>> >
>> > The 2 main features I am looking for and I am willing to implement are
>> as
>> > follows:
>> >
>> >
>> > 1. On initial connection of a new client to the websocket endpoint,
>> I'd
>> > like to be able to send a message telling the client about the
>> server's
>> > capabilities
>> > 2. When the client first connects, it used a request parameter (i.e.
>> > ?for=purpose) in the initial UPGRADE request and I need to capture
>> those
>> > values (preferably as headers on the Exchange)
>> >
>> > Could anyone point me in the right direction for where to look so that I
>> > can implement these changes in the WebSocket module? I know that there
>> are
>> > several implementations (Jetty/AHC/etc..), so I assume that it will
>> need to
>> > be implemented in all of them.
>> >
>> > Thanks in advance!!
>> >
>> > Deven
>>
>>
>>
>> --
>> Claus Ibsen
>> -----------------
>> http://davsclaus.com @davsclaus
>> Camel in Action 2: https://www.manning.com/ibsen2
>>
>
>
Re: WebSockets and request parameters
Posted by Deven Phillips <de...@gmail.com>.
Claus,
Thanks for the information... I will get in there and try to get it
done this weekend.
Cheers,
Deven
On Thu, Mar 17, 2016 at 3:46 AM, Claus Ibsen <cl...@gmail.com> wrote:
> Yeah
>
> Feel free to dive into the source code, there are 3 ws modules
>
> camel-websocket
> camel-ahc-ws
> amel-atmosphere-websocket
>
>
>
> On Tue, Mar 15, 2016 at 6:23 PM, Deven Phillips
> <de...@gmail.com> wrote:
> > Hi all,
> >
> > We are using WebSockets for some our inter-service communications and
> I
> > am working to replace some legacy code with some Camel routes, but I am
> > running into a problem of needs some functionality which is not currently
> > present in Camel.
> >
> > The 2 main features I am looking for and I am willing to implement are as
> > follows:
> >
> >
> > 1. On initial connection of a new client to the websocket endpoint,
> I'd
> > like to be able to send a message telling the client about the
> server's
> > capabilities
> > 2. When the client first connects, it used a request parameter (i.e.
> > ?for=purpose) in the initial UPGRADE request and I need to capture
> those
> > values (preferably as headers on the Exchange)
> >
> > Could anyone point me in the right direction for where to look so that I
> > can implement these changes in the WebSocket module? I know that there
> are
> > several implementations (Jetty/AHC/etc..), so I assume that it will need
> to
> > be implemented in all of them.
> >
> > Thanks in advance!!
> >
> > Deven
>
>
>
> --
> Claus Ibsen
> -----------------
> http://davsclaus.com @davsclaus
> Camel in Action 2: https://www.manning.com/ibsen2
>
Re: WebSockets and request parameters
Posted by Deven Phillips <de...@gmail.com>.
Claus,
Thanks for the information... I will get in there and try to get it
done this weekend.
Cheers,
Deven
On Thu, Mar 17, 2016 at 3:46 AM, Claus Ibsen <cl...@gmail.com> wrote:
> Yeah
>
> Feel free to dive into the source code, there are 3 ws modules
>
> camel-websocket
> camel-ahc-ws
> amel-atmosphere-websocket
>
>
>
> On Tue, Mar 15, 2016 at 6:23 PM, Deven Phillips
> <de...@gmail.com> wrote:
> > Hi all,
> >
> > We are using WebSockets for some our inter-service communications and
> I
> > am working to replace some legacy code with some Camel routes, but I am
> > running into a problem of needs some functionality which is not currently
> > present in Camel.
> >
> > The 2 main features I am looking for and I am willing to implement are as
> > follows:
> >
> >
> > 1. On initial connection of a new client to the websocket endpoint,
> I'd
> > like to be able to send a message telling the client about the
> server's
> > capabilities
> > 2. When the client first connects, it used a request parameter (i.e.
> > ?for=purpose) in the initial UPGRADE request and I need to capture
> those
> > values (preferably as headers on the Exchange)
> >
> > Could anyone point me in the right direction for where to look so that I
> > can implement these changes in the WebSocket module? I know that there
> are
> > several implementations (Jetty/AHC/etc..), so I assume that it will need
> to
> > be implemented in all of them.
> >
> > Thanks in advance!!
> >
> > Deven
>
>
>
> --
> Claus Ibsen
> -----------------
> http://davsclaus.com @davsclaus
> Camel in Action 2: https://www.manning.com/ibsen2
>
Re: WebSockets and request parameters
Posted by Claus Ibsen <cl...@gmail.com>.
Yeah
Feel free to dive into the source code, there are 3 ws modules
camel-websocket
camel-ahc-ws
amel-atmosphere-websocket
On Tue, Mar 15, 2016 at 6:23 PM, Deven Phillips
<de...@gmail.com> wrote:
> Hi all,
>
> We are using WebSockets for some our inter-service communications and I
> am working to replace some legacy code with some Camel routes, but I am
> running into a problem of needs some functionality which is not currently
> present in Camel.
>
> The 2 main features I am looking for and I am willing to implement are as
> follows:
>
>
> 1. On initial connection of a new client to the websocket endpoint, I'd
> like to be able to send a message telling the client about the server's
> capabilities
> 2. When the client first connects, it used a request parameter (i.e.
> ?for=purpose) in the initial UPGRADE request and I need to capture those
> values (preferably as headers on the Exchange)
>
> Could anyone point me in the right direction for where to look so that I
> can implement these changes in the WebSocket module? I know that there are
> several implementations (Jetty/AHC/etc..), so I assume that it will need to
> be implemented in all of them.
>
> Thanks in advance!!
>
> Deven
--
Claus Ibsen
-----------------
http://davsclaus.com @davsclaus
Camel in Action 2: https://www.manning.com/ibsen2
Re: WebSockets and request parameters
Posted by Claus Ibsen <cl...@gmail.com>.
Yeah
Feel free to dive into the source code, there are 3 ws modules
camel-websocket
camel-ahc-ws
amel-atmosphere-websocket
On Tue, Mar 15, 2016 at 6:23 PM, Deven Phillips
<de...@gmail.com> wrote:
> Hi all,
>
> We are using WebSockets for some our inter-service communications and I
> am working to replace some legacy code with some Camel routes, but I am
> running into a problem of needs some functionality which is not currently
> present in Camel.
>
> The 2 main features I am looking for and I am willing to implement are as
> follows:
>
>
> 1. On initial connection of a new client to the websocket endpoint, I'd
> like to be able to send a message telling the client about the server's
> capabilities
> 2. When the client first connects, it used a request parameter (i.e.
> ?for=purpose) in the initial UPGRADE request and I need to capture those
> values (preferably as headers on the Exchange)
>
> Could anyone point me in the right direction for where to look so that I
> can implement these changes in the WebSocket module? I know that there are
> several implementations (Jetty/AHC/etc..), so I assume that it will need to
> be implemented in all of them.
>
> Thanks in advance!!
>
> Deven
--
Claus Ibsen
-----------------
http://davsclaus.com @davsclaus
Camel in Action 2: https://www.manning.com/ibsen2