Re: WebSocket enpoint as a tapestry service

2016-10-26 Thread Peter Hvass
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 
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 
> 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" 
> > 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

2016-10-26 Thread Kalle Korhonen
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 
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" 
> 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

2016-10-26 Thread Lance Java
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" 
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

2016-10-26 Thread Cezary Biernacki
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  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
>


WebSocket enpoint as a tapestry service

2016-10-26 Thread Qbyte Consulting
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: Deploying webapp on busy public server failing hard

2016-10-26 Thread Dimitris Zenios
I thing your best solution is what you described.

Compile all less to css on building.

On Tue, Oct 25, 2016 at 4:36 PM, Peter Hvass 
wrote:

> Hello all,
>
> Sorry for the late response on this one!
>
> About the warmup page - thanks! I am using this now - it bypasses the
> issues I was facing with AWS ELB's health checks but still means a *very*
> slow deployment time.
>
> I had posted a similar issue from an old work address some time ago - look
> for '5.4 LESS Coffee to CSS JS During Build Instead of First Access' on
> this list. Howard replied saying this was outside Tapestry's scope and
> suggested using WRO4J's maven plugin.
>
> I'm aware that Tapestry used to include WRO4J as part of webresources but
> then switched to less4j instead. I did some reading on the particular Maven
> plugin for wro4j - it looks very fiddly indeed. Making sure it converts all
> LESS files and dumps them right back where they were in the built war file
> appears to be some kind of solution - I just haven't had the time (due to
> work constraints) to investigate further yet. Has anyone else had any luck?
>
> Regarding PageLoader - I tried this approach the other day - the sad thing
> is ComponentSource.getPage (PageLoaderImpl uses this) did not seem to
> trigger the compilation/minification etc. of assets (and so does not solve
> our problem). To test this I supplied my warmup page which includes all of
> the heavy LESS files in need of compilation.
>
> Will do my best to investigate the wro4j maven plugin option - will report
> back in case I figure something out - in the meantime if anyone else has
> any other ideas or approaches I would be incredibly grateful!
>
> Kindest regards,
> Peter
>
> On 5 July 2016 at 16:07, Peter Hvass  wrote:
> >
> >> Hello all,
> >>
> >> The solution is kind of obvious here though I just wanted to feel around
> >> for any alternatives.
> >>
> >> I'm deploying a small web application to a Tomcat 8 server handled by
> >> Amazon Web Service's Elastic Beanstalk service - load balancers etc.
> etc.
> >>
> >> This is quite a busy site - so we'll typically see around 100 concurrent
> >> users.
> >>
> >> When I deploy a new version of the web app, the 'first load' is very
> >> heavy - mostly due to LESS compilation (tapestry-webresources, wro4j).
> When
> >> 100 concurrent users hit for that 'first load' the server immediately
> falls
> >> over in a 100% CPU death spiral.
> >>
> >> My workaround thus far has been to deploy the new version to a secondary
> >> server, access it for the first load myself and then throw it to the
> >> hordes. This is annoying and time-consuming.
> >>
> >> Ideally it would be great if LESS compilation could occur as part of
> >> building the WAR file rather than live on the server. We never make
> changes
> >> to files inside the WAR file directly. Has anyone been able to achieve
> this?
> >>
> >> Kind regards,
> >> Peter
> >>
> >
> >
>