You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@tapestry.apache.org by Qbyte Consulting <qb...@gmail.com> on 2016/10/26 18:16:07 UTC

WebSocket enpoint as a tapestry service

I want to develop a tapestry chat component that uses a WebSocket to handle
real time text messages. I need to integrate so that users can see who is
logged in to the Tapestry app.

How would I make a class in a Tapestry app a WS endoint that can also
access my apps Tapestry services as well as handle the WS client?

John

Re: WebSocket enpoint as a tapestry service

Posted by Norman Franke <fr...@bethzur.com>.
Yes indeed. Look at the header in AtmosphereObjectFactory.java :)

-Norman

> On Oct 27, 2016, at 4:18 PM, Lance Java <la...@googlemail.com> wrote:
> 
> I'm guessing it's similar to this?
> https://github.com/uklance/tapestry-atmosphere/blob/master/tapestry-atmosphere/src/main/java/org/lazan/t5/atmosphere/services/TapestryAtmosphereObjectFactory.java
> 
> On 27 Oct 2016 9:12 p.m., "Norman Franke" <fr...@bethzur.com> wrote:
> 
>> I wanted to create a web chat application. I based it off of Atmosphere (
>> http://async-io.org). I made a small contribution to that project to make
>> integration with Tapestry easier (primarily for IoC.) It was enough to get
>> it working for me. Atmosphere provides a nice JavaScript API for the client
>> side and can fall back to pre-WebSocket technologies.
>> 
>> -Norman
>> 
>>> On Oct 26, 2016, at 4:39 PM, Cezary Biernacki <ce...@gmail.com>
>> wrote:
>>> 
>>> Hi John,
>>> I am working on an application that uses both Tapestry and WebSockets.
>> The
>>> integration is quite easy. Write your endpoint class as a normal service,
>>> so you can inject/request your other Tapestry-based services in usual
>> way.
>>> Then in your AppModule add startup method (see @Startup annotation), that
>>> just register your websocket handling services in whatever  websocket
>> stack
>>> you are using (we use Jetty's WevSocketServlets).
>>> 
>>> Cezary
>>> 
>>> 
>>> On Wed, Oct 26, 2016 at 8:16 PM, Qbyte Consulting <
>> qbyteconsulting@gmail.com
>>>> wrote:
>>> 
>>>> I want to develop a tapestry chat component that uses a WebSocket to
>> handle
>>>> real time text messages. I need to integrate so that users can see who
>> is
>>>> logged in to the Tapestry app.
>>>> 
>>>> How would I make a class in a Tapestry app a WS endoint that can also
>>>> access my apps Tapestry services as well as handle the WS client?
>>>> 
>>>> John
>>>> 
>> 
>> 
>> ---------------------------------------------------------------------
>> To unsubscribe, e-mail: users-unsubscribe@tapestry.apache.org
>> For additional commands, e-mail: users-help@tapestry.apache.org
>> 
>> 


---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@tapestry.apache.org
For additional commands, e-mail: users-help@tapestry.apache.org


Re: WebSocket enpoint as a tapestry service

Posted by Lance Java <la...@googlemail.com>.
I'm guessing it's similar to this?
https://github.com/uklance/tapestry-atmosphere/blob/master/tapestry-atmosphere/src/main/java/org/lazan/t5/atmosphere/services/TapestryAtmosphereObjectFactory.java

On 27 Oct 2016 9:12 p.m., "Norman Franke" <fr...@bethzur.com> wrote:

> I wanted to create a web chat application. I based it off of Atmosphere (
> http://async-io.org). I made a small contribution to that project to make
> integration with Tapestry easier (primarily for IoC.) It was enough to get
> it working for me. Atmosphere provides a nice JavaScript API for the client
> side and can fall back to pre-WebSocket technologies.
>
> -Norman
>
> > On Oct 26, 2016, at 4:39 PM, Cezary Biernacki <ce...@gmail.com>
> wrote:
> >
> > Hi John,
> > I am working on an application that uses both Tapestry and WebSockets.
> The
> > integration is quite easy. Write your endpoint class as a normal service,
> > so you can inject/request your other Tapestry-based services in usual
> way.
> > Then in your AppModule add startup method (see @Startup annotation), that
> > just register your websocket handling services in whatever  websocket
> stack
> > you are using (we use Jetty's WevSocketServlets).
> >
> > Cezary
> >
> >
> > On Wed, Oct 26, 2016 at 8:16 PM, Qbyte Consulting <
> qbyteconsulting@gmail.com
> >> wrote:
> >
> >> I want to develop a tapestry chat component that uses a WebSocket to
> handle
> >> real time text messages. I need to integrate so that users can see who
> is
> >> logged in to the Tapestry app.
> >>
> >> How would I make a class in a Tapestry app a WS endoint that can also
> >> access my apps Tapestry services as well as handle the WS client?
> >>
> >> John
> >>
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@tapestry.apache.org
> For additional commands, e-mail: users-help@tapestry.apache.org
>
>

Re: WebSocket enpoint as a tapestry service

Posted by Norman Franke <fr...@bethzur.com>.
I wanted to create a web chat application. I based it off of Atmosphere (http://async-io.org). I made a small contribution to that project to make integration with Tapestry easier (primarily for IoC.) It was enough to get it working for me. Atmosphere provides a nice JavaScript API for the client side and can fall back to pre-WebSocket technologies.

-Norman

> On Oct 26, 2016, at 4:39 PM, Cezary Biernacki <ce...@gmail.com> wrote:
> 
> Hi John,
> I am working on an application that uses both Tapestry and WebSockets. The
> integration is quite easy. Write your endpoint class as a normal service,
> so you can inject/request your other Tapestry-based services in usual way.
> Then in your AppModule add startup method (see @Startup annotation), that
> just register your websocket handling services in whatever  websocket stack
> you are using (we use Jetty's WevSocketServlets).
> 
> Cezary
> 
> 
> On Wed, Oct 26, 2016 at 8:16 PM, Qbyte Consulting <qbyteconsulting@gmail.com
>> wrote:
> 
>> I want to develop a tapestry chat component that uses a WebSocket to handle
>> real time text messages. I need to integrate so that users can see who is
>> logged in to the Tapestry app.
>> 
>> How would I make a class in a Tapestry app a WS endoint that can also
>> access my apps Tapestry services as well as handle the WS client?
>> 
>> John
>> 


---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@tapestry.apache.org
For additional commands, e-mail: users-help@tapestry.apache.org


Re: WebSocket enpoint as a tapestry service

Posted by Cezary Biernacki <ce...@gmail.com>.
Hi John,
I am working on an application that uses both Tapestry and WebSockets. The
integration is quite easy. Write your endpoint class as a normal service,
so you can inject/request your other Tapestry-based services in usual way.
Then in your AppModule add startup method (see @Startup annotation), that
just register your websocket handling services in whatever  websocket stack
you are using (we use Jetty's WevSocketServlets).

Cezary


On Wed, Oct 26, 2016 at 8:16 PM, Qbyte Consulting <qbyteconsulting@gmail.com
> wrote:

> I want to develop a tapestry chat component that uses a WebSocket to handle
> real time text messages. I need to integrate so that users can see who is
> logged in to the Tapestry app.
>
> How would I make a class in a Tapestry app a WS endoint that can also
> access my apps Tapestry services as well as handle the WS client?
>
> John
>

AW: WebSocket enpoint as a tapestry service

Posted by "Dr. Jochimsen, Janko" <ja...@urios-beratung.de>.
Dear Lance,

I am a bit lost with the Atmosphere Demo. 

I am following the instructions here

https://github.com/uklance/tapestry-atmosphere

but there are several issues.

As a starting point I use the Maven Archetype 5.4.3 for eclipse. Within eclipse I use jetty 6.1.16. 

Then I adjust the  pom.xml with the given snipped setting the version to 0.0.6. If I just try to start the App without adding one line of atmosphere specific code it crashes with this error:

[ERROR] failed app
java.lang.NoClassDefFoundError: org/atmosphere/cpr/AtmosphereResourceFactory
	at java.lang.Class.forName0(Native Method)
	at java.lang.Class.forName(Class.java:348)
	at org.apache.tapestry5.ioc.RegistryBuilder.add(RegistryBuilder.java:159)
	at org.apache.tapestry5.ioc.IOCUtilities.addModulesInList(IOCUtilities.java:132)
	at org.apache.tapestry5.ioc.IOCUtilities.addModulesInManifest(IOCUtilities.java:105)
	at org.apache.tapestry5.ioc.IOCUtilities.addDefaultModules(IOCUtilities.java:76)
[...]


The next issue is that I can not add the 
	<async-supported>true</async-supported>

line to the web.xml because  I get the following error massage. 

cvc-complex-type.2.4.a: Invalid content was found starting with element 'async-supported'. One of '{"http://
 java.sun.com/xml/ns/j2ee":init-param}' is expected.


This is probably because the new web-app definition looks like this: 

<web-app xmlns="http://java.sun.com/xml/ns/j2ee" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
    xsi:schemaLocation="http://java.sun.com/xml/ns/j2ee http://java.sun.com/xml/ns/j2ee/web-app_2_4.xsd"
    version="2.4">


So I am a bit lost. It looks like the description is geared toward older versions of tapestry. But it would be really wonderful if there would be a short explanation how to use this very advanced project in what I think is the "normal" starting point for a tapestry project.


Thanks for your help


Janko




-----Ursprüngliche Nachricht-----
Von: Lance Java [mailto:lance.java@googlemail.com] 
Gesendet: Mittwoch, 26. Oktober 2016 23:27
An: Tapestry users <us...@tapestry.apache.org>
Betreff: Re: WebSocket enpoint as a tapestry service

There's a chat demo in both tapestry-atmosphere and tapestry-cometd

Atmosphere
Demo: http://t5atmosphere-lazan.rhcloud.com/
Source:
https://github.com/uklance/tapestry-atmosphere/tree/master/tapestry-atmosphere-demo

Cometd
Demo: http://t5cometd-lazan.rhcloud.com/chat
Source:
https://github.com/uklance/tapestry-cometd/tree/master/tapestry-cometd-demo

On 26 Oct 2016 7:16 p.m., "Qbyte Consulting" <qb...@gmail.com>
wrote:

> I want to develop a tapestry chat component that uses a WebSocket to 
> handle real time text messages. I need to integrate so that users can 
> see who is logged in to the Tapestry app.
>
> How would I make a class in a Tapestry app a WS endoint that can also 
> access my apps Tapestry services as well as handle the WS client?
>
> John
>

Re: WebSocket enpoint as a tapestry service

Posted by Qbyte Consulting <qb...@gmail.com>.
 I'll try tapestry-atmosphere, I had a quick look over demo code and it looks slick.

I think this or similar ought to be a core feature or at least a proper tapestry sub project. It would definitely make tapestry more appealing for today's SPAs and mobile apps.

John 

Sent from my iPhone

> On 27 Oct 2016, at 07:40, Peter Hvass <pe...@jamesinnes.com> wrote:
> 
> I've been meaning to have a go with Lance's tapestry-atmosphere - seems
> very straightforward especially for teams with little time to roll their
> own!
> 
> Kalle + Cezary - (if feasible - licenses, projects etc.) would it not be
> worth all of us jumping on Lance's library (for plugging in Atmosphere) and
> possibly submitting patches/fixes so we have one bulletproof and
> fully-featured Tapestrified approach to this?
> 
> Is there an argument that this sort of push-related functionality should be
> built into Tapestry directly for a future version? Push and notifications
> are two headline features for an ever mobile-friendly web..
> 
> Thanks,
> Peter
> On 27 October 2016 at 01:35, Kalle Korhonen <ka...@gmail.com>
> wrote:
> 
>> It's relatively simple like Cezary says. The only potential issue is with
>> authenticating JSR 356 websockets, which may require a bit of gymnastics
>> depending on your needs. If you are using sessions, you can fetch
>> underlying (servlet) session from the handshake request (see
>> http://stackoverflow.com/questions/21888425/accessing-servletcontext-and-
>> httpsession-in-onmessage-of-a-jsr-356-serverendpo/27057359).
>> If you are using sessionless authentication (w/ JWT), you can pass the
>> bearer token around in the sub-protocol header,
>> namely Sec-WebSocket-Protocol (see
>> http://stackoverflow.com/questions/22383089/is-it-possible-to-use-bearer-
>> authentication-for-websocket-upgrade-requests/35108078
>> ).
>> 
>> Kalle
>> 
>> On Wed, Oct 26, 2016 at 2:27 PM, Lance Java <la...@googlemail.com>
>> wrote:
>> 
>>> There's a chat demo in both tapestry-atmosphere and tapestry-cometd
>>> 
>>> Atmosphere
>>> Demo: http://t5atmosphere-lazan.rhcloud.com/
>>> Source:
>>> https://github.com/uklance/tapestry-atmosphere/tree/
>>> master/tapestry-atmosphere-demo
>>> 
>>> Cometd
>>> Demo: http://t5cometd-lazan.rhcloud.com/chat
>>> Source:
>>> https://github.com/uklance/tapestry-cometd/tree/master/
>>> tapestry-cometd-demo
>>> 
>>> On 26 Oct 2016 7:16 p.m., "Qbyte Consulting" <qb...@gmail.com>
>>> wrote:
>>> 
>>>> I want to develop a tapestry chat component that uses a WebSocket to
>>> handle
>>>> real time text messages. I need to integrate so that users can see who
>> is
>>>> logged in to the Tapestry app.
>>>> 
>>>> How would I make a class in a Tapestry app a WS endoint that can also
>>>> access my apps Tapestry services as well as handle the WS client?
>>>> 
>>>> John
>>>> 
>>> 
>> 

---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@tapestry.apache.org
For additional commands, e-mail: users-help@tapestry.apache.org


Re: WebSocket enpoint as a tapestry service

Posted by Peter Hvass <pe...@jamesinnes.com>.
That sort of swappable implementation would fit right in with the swappable
JavaScript framework for sure!

I saw some discussion related to whether Prototype support should be
dropped as a default as per Howard's past wishes on the dev boards. It made
me think that perhaps the different js frameworks should instead be
separate Maven modules - a skeleton module (perhaps in quickstart form)
could be revealed so people can add their own. If no module is added then
there's simply no baked-in javascript support - any core components/mixins
just noop or act in a completely js-free way.

Similarly - the core and generic bits and pieces required to support
features surrounding push could be built in and pluggable implementations
of atmosphere, socksjs, cometd etc. could be developed separately. If none
are present then things just noop or fail to work (as intentional).

I know this all increases the scope of the current thread - it may be worth
taking into a separate chat - but it would be awesome to see SASS support -
the overriding of core styles has always been a bit mucky - the baked-in
bootstrap version is old. And if Tapestry is framework-agnostic when it
comes to JS then why should it not also be so for Bootstrap?

Returning to the topic at hand - having looked at Lance's approach again -
I especially find tapestry-atmosphere to be very easy to digest - the
examples are enough to get going with it and as you say yourself, Lance, it
does feel very 'Tapestryesque'. Will definitely dig into this as soon as
time allows!

Kind regards,
Peter

On 27 October 2016 at 10:32, Lance Java <la...@googlemail.com> wrote:

> I'd love to see tapestry support websockets out of the box, perhaps with a
> swappable implementation (atmosphere, socksjs, cometd etc)
>
> I've tried to uphold the "tapestry philosophy" in both implementations
> using event-handlers, blocks and zones (they're actually a pushTarget
> rather than a zone). If Tapestry were to support websockets out of the box
> I'd argue it should implement a similar approach.
>
> On 27 Oct 2016 7:40 a.m., "Peter Hvass" <pe...@jamesinnes.com>
> wrote:
>
> > I've been meaning to have a go with Lance's tapestry-atmosphere - seems
> > very straightforward especially for teams with little time to roll their
> > own!
> >
> > Kalle + Cezary - (if feasible - licenses, projects etc.) would it not be
> > worth all of us jumping on Lance's library (for plugging in Atmosphere)
> and
> > possibly submitting patches/fixes so we have one bulletproof and
> > fully-featured Tapestrified approach to this?
> >
> > Is there an argument that this sort of push-related functionality should
> be
> > built into Tapestry directly for a future version? Push and notifications
> > are two headline features for an ever mobile-friendly web..
> >
> > Thanks,
> > Peter
> > On 27 October 2016 at 01:35, Kalle Korhonen <ka...@gmail.com>
> > wrote:
> >
> > > It's relatively simple like Cezary says. The only potential issue is
> with
> > > authenticating JSR 356 websockets, which may require a bit of
> gymnastics
> > > depending on your needs. If you are using sessions, you can fetch
> > > underlying (servlet) session from the handshake request (see
> > > http://stackoverflow.com/questions/21888425/accessing-
> > servletcontext-and-
> > > httpsession-in-onmessage-of-a-jsr-356-serverendpo/27057359).
> > > If you are using sessionless authentication (w/ JWT), you can pass the
> > > bearer token around in the sub-protocol header,
> > > namely Sec-WebSocket-Protocol (see
> > > http://stackoverflow.com/questions/22383089/is-it-
> > possible-to-use-bearer-
> > > authentication-for-websocket-upgrade-requests/35108078
> > > ).
> > >
> > > Kalle
> > >
> > > On Wed, Oct 26, 2016 at 2:27 PM, Lance Java <lance.java@googlemail.com
> >
> > > wrote:
> > >
> > > > There's a chat demo in both tapestry-atmosphere and tapestry-cometd
> > > >
> > > > Atmosphere
> > > > Demo: http://t5atmosphere-lazan.rhcloud.com/
> > > > Source:
> > > > https://github.com/uklance/tapestry-atmosphere/tree/
> > > > master/tapestry-atmosphere-demo
> > > >
> > > > Cometd
> > > > Demo: http://t5cometd-lazan.rhcloud.com/chat
> > > > Source:
> > > > https://github.com/uklance/tapestry-cometd/tree/master/
> > > > tapestry-cometd-demo
> > > >
> > > > On 26 Oct 2016 7:16 p.m., "Qbyte Consulting" <
> > qbyteconsulting@gmail.com>
> > > > wrote:
> > > >
> > > > > I want to develop a tapestry chat component that uses a WebSocket
> to
> > > > handle
> > > > > real time text messages. I need to integrate so that users can see
> > who
> > > is
> > > > > logged in to the Tapestry app.
> > > > >
> > > > > How would I make a class in a Tapestry app a WS endoint that can
> also
> > > > > access my apps Tapestry services as well as handle the WS client?
> > > > >
> > > > > John
> > > > >
> > > >
> > >
> >
>

Re: WebSocket enpoint as a tapestry service

Posted by Lance Java <la...@googlemail.com>.
I'd love to see tapestry support websockets out of the box, perhaps with a
swappable implementation (atmosphere, socksjs, cometd etc)

I've tried to uphold the "tapestry philosophy" in both implementations
using event-handlers, blocks and zones (they're actually a pushTarget
rather than a zone). If Tapestry were to support websockets out of the box
I'd argue it should implement a similar approach.

On 27 Oct 2016 7:40 a.m., "Peter Hvass" <pe...@jamesinnes.com> wrote:

> I've been meaning to have a go with Lance's tapestry-atmosphere - seems
> very straightforward especially for teams with little time to roll their
> own!
>
> Kalle + Cezary - (if feasible - licenses, projects etc.) would it not be
> worth all of us jumping on Lance's library (for plugging in Atmosphere) and
> possibly submitting patches/fixes so we have one bulletproof and
> fully-featured Tapestrified approach to this?
>
> Is there an argument that this sort of push-related functionality should be
> built into Tapestry directly for a future version? Push and notifications
> are two headline features for an ever mobile-friendly web..
>
> Thanks,
> Peter
> On 27 October 2016 at 01:35, Kalle Korhonen <ka...@gmail.com>
> wrote:
>
> > It's relatively simple like Cezary says. The only potential issue is with
> > authenticating JSR 356 websockets, which may require a bit of gymnastics
> > depending on your needs. If you are using sessions, you can fetch
> > underlying (servlet) session from the handshake request (see
> > http://stackoverflow.com/questions/21888425/accessing-
> servletcontext-and-
> > httpsession-in-onmessage-of-a-jsr-356-serverendpo/27057359).
> > If you are using sessionless authentication (w/ JWT), you can pass the
> > bearer token around in the sub-protocol header,
> > namely Sec-WebSocket-Protocol (see
> > http://stackoverflow.com/questions/22383089/is-it-
> possible-to-use-bearer-
> > authentication-for-websocket-upgrade-requests/35108078
> > ).
> >
> > Kalle
> >
> > On Wed, Oct 26, 2016 at 2:27 PM, Lance Java <la...@googlemail.com>
> > wrote:
> >
> > > There's a chat demo in both tapestry-atmosphere and tapestry-cometd
> > >
> > > Atmosphere
> > > Demo: http://t5atmosphere-lazan.rhcloud.com/
> > > Source:
> > > https://github.com/uklance/tapestry-atmosphere/tree/
> > > master/tapestry-atmosphere-demo
> > >
> > > Cometd
> > > Demo: http://t5cometd-lazan.rhcloud.com/chat
> > > Source:
> > > https://github.com/uklance/tapestry-cometd/tree/master/
> > > tapestry-cometd-demo
> > >
> > > On 26 Oct 2016 7:16 p.m., "Qbyte Consulting" <
> qbyteconsulting@gmail.com>
> > > wrote:
> > >
> > > > I want to develop a tapestry chat component that uses a WebSocket to
> > > handle
> > > > real time text messages. I need to integrate so that users can see
> who
> > is
> > > > logged in to the Tapestry app.
> > > >
> > > > How would I make a class in a Tapestry app a WS endoint that can also
> > > > access my apps Tapestry services as well as handle the WS client?
> > > >
> > > > John
> > > >
> > >
> >
>

Re: WebSocket enpoint as a tapestry service

Posted by Peter Hvass <pe...@jamesinnes.com>.
I've been meaning to have a go with Lance's tapestry-atmosphere - seems
very straightforward especially for teams with little time to roll their
own!

Kalle + Cezary - (if feasible - licenses, projects etc.) would it not be
worth all of us jumping on Lance's library (for plugging in Atmosphere) and
possibly submitting patches/fixes so we have one bulletproof and
fully-featured Tapestrified approach to this?

Is there an argument that this sort of push-related functionality should be
built into Tapestry directly for a future version? Push and notifications
are two headline features for an ever mobile-friendly web..

Thanks,
Peter
On 27 October 2016 at 01:35, Kalle Korhonen <ka...@gmail.com>
wrote:

> It's relatively simple like Cezary says. The only potential issue is with
> authenticating JSR 356 websockets, which may require a bit of gymnastics
> depending on your needs. If you are using sessions, you can fetch
> underlying (servlet) session from the handshake request (see
> http://stackoverflow.com/questions/21888425/accessing-servletcontext-and-
> httpsession-in-onmessage-of-a-jsr-356-serverendpo/27057359).
> If you are using sessionless authentication (w/ JWT), you can pass the
> bearer token around in the sub-protocol header,
> namely Sec-WebSocket-Protocol (see
> http://stackoverflow.com/questions/22383089/is-it-possible-to-use-bearer-
> authentication-for-websocket-upgrade-requests/35108078
> ).
>
> Kalle
>
> On Wed, Oct 26, 2016 at 2:27 PM, Lance Java <la...@googlemail.com>
> wrote:
>
> > There's a chat demo in both tapestry-atmosphere and tapestry-cometd
> >
> > Atmosphere
> > Demo: http://t5atmosphere-lazan.rhcloud.com/
> > Source:
> > https://github.com/uklance/tapestry-atmosphere/tree/
> > master/tapestry-atmosphere-demo
> >
> > Cometd
> > Demo: http://t5cometd-lazan.rhcloud.com/chat
> > Source:
> > https://github.com/uklance/tapestry-cometd/tree/master/
> > tapestry-cometd-demo
> >
> > On 26 Oct 2016 7:16 p.m., "Qbyte Consulting" <qb...@gmail.com>
> > wrote:
> >
> > > I want to develop a tapestry chat component that uses a WebSocket to
> > handle
> > > real time text messages. I need to integrate so that users can see who
> is
> > > logged in to the Tapestry app.
> > >
> > > How would I make a class in a Tapestry app a WS endoint that can also
> > > access my apps Tapestry services as well as handle the WS client?
> > >
> > > John
> > >
> >
>

Re: WebSocket enpoint as a tapestry service

Posted by Kalle Korhonen <ka...@gmail.com>.
It's relatively simple like Cezary says. The only potential issue is with
authenticating JSR 356 websockets, which may require a bit of gymnastics
depending on your needs. If you are using sessions, you can fetch
underlying (servlet) session from the handshake request (see
http://stackoverflow.com/questions/21888425/accessing-servletcontext-and-httpsession-in-onmessage-of-a-jsr-356-serverendpo/27057359).
If you are using sessionless authentication (w/ JWT), you can pass the
bearer token around in the sub-protocol header,
namely Sec-WebSocket-Protocol (see
http://stackoverflow.com/questions/22383089/is-it-possible-to-use-bearer-authentication-for-websocket-upgrade-requests/35108078
).

Kalle

On Wed, Oct 26, 2016 at 2:27 PM, Lance Java <la...@googlemail.com>
wrote:

> There's a chat demo in both tapestry-atmosphere and tapestry-cometd
>
> Atmosphere
> Demo: http://t5atmosphere-lazan.rhcloud.com/
> Source:
> https://github.com/uklance/tapestry-atmosphere/tree/
> master/tapestry-atmosphere-demo
>
> Cometd
> Demo: http://t5cometd-lazan.rhcloud.com/chat
> Source:
> https://github.com/uklance/tapestry-cometd/tree/master/
> tapestry-cometd-demo
>
> On 26 Oct 2016 7:16 p.m., "Qbyte Consulting" <qb...@gmail.com>
> wrote:
>
> > I want to develop a tapestry chat component that uses a WebSocket to
> handle
> > real time text messages. I need to integrate so that users can see who is
> > logged in to the Tapestry app.
> >
> > How would I make a class in a Tapestry app a WS endoint that can also
> > access my apps Tapestry services as well as handle the WS client?
> >
> > John
> >
>

Re: WebSocket enpoint as a tapestry service

Posted by Lance Java <la...@googlemail.com>.
There's a chat demo in both tapestry-atmosphere and tapestry-cometd

Atmosphere
Demo: http://t5atmosphere-lazan.rhcloud.com/
Source:
https://github.com/uklance/tapestry-atmosphere/tree/master/tapestry-atmosphere-demo

Cometd
Demo: http://t5cometd-lazan.rhcloud.com/chat
Source:
https://github.com/uklance/tapestry-cometd/tree/master/tapestry-cometd-demo

On 26 Oct 2016 7:16 p.m., "Qbyte Consulting" <qb...@gmail.com>
wrote:

> I want to develop a tapestry chat component that uses a WebSocket to handle
> real time text messages. I need to integrate so that users can see who is
> logged in to the Tapestry app.
>
> How would I make a class in a Tapestry app a WS endoint that can also
> access my apps Tapestry services as well as handle the WS client?
>
> John
>