[undertow-dev] Websocket proxy: monitor (in)activity

Stuart Douglas sdouglas at redhat.com
Thu Jun 23 06:27:36 EDT 2016


Are you talking about the proxy or backend nodes?

The proxy basically knows nothing about websockets, it treats the
upgrade as a TCP stream, and can't do any special handling. You could
still use the undertow native API to register a close listener though,
but it will be invoked every time the connection closes.

The session listener is not related, basically the HTTP session is not
related to the websocket session.

Stuart


On Thu, Jun 23, 2016 at 7:52 PM, Frederick Michielssen
<frederick.michielssen at openanalytics.eu> wrote:
> Hi Stuart,
>
> Thanks for the pointer.
> This appears to work, but what I would like to do next, is to perform additional actions when the websocket closes.
> At first glance, I would use DeploymentInfo.addSessionListener, but these sessions will expire (and call sessionDestroyed) regardless of websocket activity, right?
>
> - Frederick
>
> ----- Original Message -----
> From: "Stuart Douglas" <sdouglas at redhat.com>
> To: "Frederick Michielssen" <frederick.michielssen at openanalytics.eu>
> Cc: "undertow-dev" <undertow-dev at lists.jboss.org>
> Sent: Monday, June 20, 2016 2:57:18 AM
> Subject: Re: [undertow-dev] Websocket proxy: monitor (in)activity
>
> Are you using Wildfly or embedded Undertow?
>
> Either way you basically want to set an idle timeout on the conduit.
> Setting io.undertow.UndertowOptions#IDLE_TIMEOUT should do it, if you
> are using the embedded builder you need to call setServerOptions with
> this setting and your timeout, if you are using wildfly you need to
> set in on the listener in standalone.xml.
>
> Stuart
>
> On Fri, Jun 17, 2016 at 11:50 PM, Frederick Michielssen
> <frederick.michielssen at openanalytics.eu> wrote:
>> Hi,
>>
>> Our application uses Undertow to serve a Spring-boot application, as well as proxy websocket connections to a backend server.
>> Now we would like to monitor activity on the websocket, so that specific resources can be freed when the websocket has been inactive for a long time.
>> Is there an appropriate way we can detect this in Undertow? Maybe some timeout setting that can be used for this purpose?
>>
>> -Frederick
>> _______________________________________________
>> undertow-dev mailing list
>> undertow-dev at lists.jboss.org
>> https://lists.jboss.org/mailman/listinfo/undertow-dev


More information about the undertow-dev mailing list