Websocket configuration Basex 12

Monday, 4 August 2025 · 4 messages · last reply 5 Aug 2025
AB
Andy Bunce4 Aug 2025 00:39 #
Hi, I would like to increase the websocket message length from the default of 64 KB. The websocket documentation implies this can be done via web.xml [1] However, while searching for the syntax I came across the suggestion it is different with the Jetty version 12 API [2] The Jetty docs have this example [3]
// Configure the ServerContainer.
            container.setDefaultMaxTextMessageBufferSize(128 * 1024);
CG
Christian Grün4 Aug 2025 16:35 #
Hi Andy, I wanted to introduce new options first, but I dropped this approach, and I decided to simulate the old behavior of Jetty. The init-param entries in the web.xml file are now parsed by BaseX and assigned to the WebSocket instance when the first WebSocket connection is created [1]. As a consequence, existing Jetty 9 web.xml WebSocket configurations should work again. Feel free to check out the latest snapshot [2] to verify if that’s true. Best, Christian PS: The docs have been updated, too [3]. [1] https://github.com/BaseXdb/basex/commit/880535ed23d11c15b58945d12049242af65486f1 [2] https://files.basex.org/releases/latest/ [3] https://docs.basex.org/main/WebSockets#configuration
Quoted text · Andy Bunce · 17 lines
Von: Andy Bunce <bunce.andy at gmail.com> Gesendet: Montag, 4. August 2025 00:39 An: BaseX <basex-talk at mailman.uni-konstanz.de> Betreff: [basex-talk] Websocket configuration Basex 12 Hi, I would like to increase the websocket message length from the default of 64 KB. The websocket documentation implies this can be done via web.xml [1] However, while searching for the syntax I came across the suggestion it is different with the Jetty version 12 API [2] The Jetty docs have this example [3] // Configure the ServerContainer. container.setDefaultMaxTextMessageBufferSize(128 * 1024); but my quick code search of the BaseX source found nothing similar. Is it possible to configure the webSocket MaxTextMessageBufferSize in BaseX 12.0? /Andy [1] https://docs.basex.org/main/WebSockets#configuration [2] https://stackoverflow.com/questions/79610426/setting-the-max-buffer-size-for-websocketclient-since-upgrading-to-jetty-12 [3] https://jetty.org/docs/jetty/12/programming-guide/server/websocket.html#standard-endpoints
AB
Andy Bunce4 Aug 2025 23:54 #
Hi Christian, Thanks for this. It sounds like a good approach and it is working for me with the latest release. /Andy
Quoted text · Christian Grün · 54 lines
On Mon, 4 Aug 2025 at 15:36, Christian Grün <cg at basex.org> wrote: > Hi Andy, > > I wanted to introduce new options first, but I dropped this approach, and > I decided to simulate the old behavior of Jetty. The init-param entries in > the web.xml file are now parsed by BaseX and assigned to the WebSocket > instance when the first WebSocket connection is created [1]. > > As a consequence, existing Jetty 9 web.xml WebSocket configurations should > work again. Feel free to check out the latest snapshot [2] to verify if > that’s true. > > Best, > Christian > > PS: The docs have been updated, too [3]. > > [1] > https://github.com/BaseXdb/basex/commit/880535ed23d11c15b58945d12049242af65486f1 > [2] https://files.basex.org/releases/latest/ > [3] https://docs.basex.org/main/WebSockets#configuration > > ------------------------------ > *Von:* Andy Bunce <bunce.andy at gmail.com> > *Gesendet:* Montag, 4. August 2025 00:39 > *An:* BaseX <basex-talk at mailman.uni-konstanz.de> > *Betreff:* [basex-talk] Websocket configuration Basex 12 > > Hi, > > I would like to increase the websocket message length from the default of > 64 KB. > The websocket documentation implies this can be done via web.xml [1] > However, while searching for the syntax I came across the suggestion it is > different with the Jetty version 12 API [2] > > The Jetty docs have this example [3] > > // Configure the ServerContainer. > container.setDefaultMaxTextMessageBufferSize(128 * 1024); > > but my quick code search of the BaseX source found nothing similar. > > Is it possible to configure the webSocket MaxTextMessageBufferSize in > BaseX 12.0? > > /Andy > > [1] https://docs.basex.org/main/WebSockets#configuration > [2] > https://stackoverflow.com/questions/79610426/setting-the-max-buffer-size-for-websocketclient-since-upgrading-to-jetty-12 > [3] > https://jetty.org/docs/jetty/12/programming-guide/server/websocket.html#standard-endpoints >
LV
Lizzi, Vincent5 Aug 2025 04:24 #
Hi Andy and Christian, This is tangential to the original question, though I’ll share this in case it helps others. I recently needed to solve “URI Too Long” errors that were encountered when the value of a query parameter in an HTTP GET request to a RESTXQ function exceeded a preset maximum length. Fortunately, there is a way to configure a higher limit by setting requestHeaderSize in jetty.xml as shown below. I also wanted to be able to configure (and find out) the HTTP port for Jetty using a system property, and had to add a SystemProperty element in jetty.xml as shown below. This is using BaseX version 11.9 which has Jetty version 11.0.25. I’ll have to try using BaseX 12 soon.
<Configure id="Server" class="org.eclipse.jetty.server.Server">

  <!-- increase max header size to resolve errors: "URI Too Long" and "WARN org.eclipse.jetty.http.HttpParser - URI is too large >8192" -->
  <New id="httpConfig" class="org.eclipse.jetty.server.HttpConfiguration">
    <Set name="requestHeaderSize">65536</Set>
  </New>

  <!-- Default connector. The Jetty stop port can be specified
       in the .basex or pom.xml configuration file.  -->
  <Call name="addConnector">
    <Arg>
      <New id="httpConnector" class="org.eclipse.jetty.server.ServerConnector">
        <Arg name="server"><Ref refid="Server"/></Arg>
        <Arg name="factories">
          <Array type="org.eclipse.jetty.server.ConnectionFactory">
            <Item>
              <New class="org.eclipse.jetty.server.HttpConnectionFactory">
                <Arg name="config">
                  <Ref refid="httpConfig"/>
                </Arg>
              </New>
            </Item>
          </Array>
        </Arg>
        <Set name="host">0.0.0.0</Set>
        <Set name="port"><SystemProperty name="jetty.http.port" default="8080"/></Set>
        <Set name="idleTimeout">60000</Set>
        <Set name="reuseAddress">true</Set>
      </New>
    </Arg>
  </Call>
</Configure>
I might have opted to use POST instead of GET for the RESTXQ function without needing to increase requestHeaderSize, but I was calling the RESTXQ function from XSLT using the doc() function. Kind regards, Vincent _____________________________________________ Vincent M. Lizzi Head of Information Standards | Taylor & Francis Group vincent.lizzi at taylorandfrancis.com<mailto:vincent.lizzi at taylorandfrancis.com> Time zone: US Eastern [https://res.public.onecdn.static.microsoft/assets/bookwithme/misc/CalendarPerson20px.png]<https://outlook.office.com/bookwithme/user/aa80d42cbb5b46dba06a5ad241d7665b at taylorandfrancis.com?anonymous&ep=owaSlotsEmailSignature> Book time to meet with me<https://outlook.office.com/bookwithme/user/aa80d42cbb5b46dba06a5ad241d7665b at taylorandfrancis.com?anonymous&ep=owaSlotsEmailSignature> Information Classification: General
Quoted text · Andy Bunce · 35 lines
From: Andy Bunce <bunce.andy at gmail.com> Sent: Monday, August 4, 2025 5:55 PM To: Christian Grün <cg at basex.org> Cc: BaseX <basex-talk at mailman.uni-konstanz.de> Subject: [basex-talk] Re: Websocket configuration Basex 12 Hi Christian, Thanks for this. It sounds like a good approach and it is working for me with the latest release. /Andy On Mon, 4 Aug 2025 at 15:36, Christian Grün <cg at basex.org<mailto:cg at basex.org>> wrote: Hi Andy, I wanted to introduce new options first, but I dropped this approach, and I decided to simulate the old behavior of Jetty. The init-param entries in the web.xml file are now parsed by BaseX and assigned to the WebSocket instance when the first WebSocket connection is created [1]. As a consequence, existing Jetty 9 web.xml WebSocket configurations should work again. Feel free to check out the latest snapshot [2] to verify if that’s true. Best, Christian PS: The docs have been updated, too [3]. [1] https://github.com/BaseXdb/basex/commit/880535ed23d11c15b58945d12049242af65486f1<https://github.com/BaseXdb/basex/commit/880535ed23d11c15b58945d12049242af65486f1> [2] https://files.basex.org/releases/latest/<https://files.basex.org/releases/latest/> [3] https://docs.basex.org/main/WebSockets#configuration<https://docs.basex.org/main/WebSockets#configuration> Von: Andy Bunce <bunce.andy at gmail.com<mailto:bunce.andy at gmail.com>> Gesendet: Montag, 4. August 2025 00:39 An: BaseX <basex-talk at mailman.uni-konstanz.de<mailto:basex-talk at mailman.uni-konstanz.de>> Betreff: [basex-talk] Websocket configuration Basex 12 Hi, I would like to increase the websocket message length from the default of 64 KB. The websocket documentation implies this can be done via web.xml [1] However, while searching for the syntax I came across the suggestion it is different with the Jetty version 12 API [2] The Jetty docs have this example [3] // Configure the ServerContainer. container.setDefaultMaxTextMessageBufferSize(128 * 1024); but my quick code search of the BaseX source found nothing similar. Is it possible to configure the webSocket MaxTextMessageBufferSize in BaseX 12.0? /Andy [1] https://docs.basex.org/main/WebSockets#configuration<https://docs.basex.org/main/WebSockets#configuration> [2] https://stackoverflow.com/questions/79610426/setting-the-max-buffer-size-for-websocketclient-since-upgrading-to-jetty-12<https://stackoverflow.com/questions/79610426/setting-the-max-buffer-size-for-websocketclient-since-upgrading-to-jetty-12> [3] https://jetty.org/docs/jetty/12/programming-guide/server/websocket.html#standard-endpoints<https://jetty.org/docs/jetty/12/programming-guide/server/websocket.html#standard-endpoints>

⚡Generated with XQuery