Aller au contenu | Aller au menu | Aller à la recherche


WildFly websocket disconnect client after 90 seconds

WildFly 29 websocket disconnect client after 90 seconds, websocket client side code 1006

Cause : "read-timeout" and "write-timeout" variables.

https://docs.wildfly.org/29/wildscribe/subsystem/undertow/server/http-listener/index.html read-timeout Configure a read timeout for a socket, in milliseconds. If the given amount of time elapses without a successful read taking place, the socket's next read will throw a {@link ReadTimeoutException}. Default Value 90000

write-timeout Configure a write timeout for a socket, in milliseconds. If the given amount of time elapses without a successful write taking place, the socket's next write will throw a {@link WriteTimeoutException}. Default Value 90000

Check current value :

[standalone@localhost:9990 /] /subsystem=undertow/server=default-server/http-listener=default:read-attribute(name=read-timeout)
{
    "outcome" => "success",
    "result" => 90000
}

[standalone@localhost:9990 /] /subsystem=undertow/server=default-server/http-listener=default:read-attribute(name=write-timeout)
{
    "outcome" => "success",
    "result" => 90000
}

Change value to zero (infinite) :

[standalone@localhost:9990 /] /subsystem=undertow/server=default-server/http-listener=default:write-attribute(name=read-timeout, value=0)
{
    "outcome" => "success",
    "response-headers" => {
        "operation-requires-reload" => true,
        "process-state" => "reload-required"
    }
}

[standalone@localhost:9990 /] /subsystem=undertow/server=default-server/http-listener=default:write-attribute(name=write-timeout, value=0)
{
    "outcome" => "success",
    "response-headers" => {
        "operation-requires-reload" => true,
        "process-state" => "reload-required"
    }
}

Reload wildfly server configuration :

[standalone@localhost:9990 /] :reload
{
    "outcome" => "success",
    "result" => undefined
}

standalone.xml :

<subsystem xmlns="urn:jboss:domain:undertow:14.0" default-virtual-host="default-host" default-servlet-container="default" default-server="default-server" statistics-enabled="${wildfly.undertow.statistics-enabled:${wildfly.statistics-enabled:false}}" default-security-domain="other">
            <byte-buffer-pool name="default"/>
            <buffer-cache name="default"/>
            <server name="default-server">
                <http-listener name="default" socket-binding="http" read-timeout="0" write-timeout="0" redirect-socket="https" enable-http2="true"/> <-- changed line with new attributes added : read-timeout="0" write-timeout="0" -->
                <https-listener name="https" socket-binding="https" ssl-context="applicationSSC" enable-http2="true"/>
                <host name="default-host" alias="localhost">

Ajouter un commentaire

Le code HTML est affiché comme du texte et les adresses web sont automatiquement transformées.

Fil des commentaires de ce billet