Max message size in Websockets exceeded?
Hi,
According to "https://docs.basex.org/11/WebSockets", the default limit for messages is 64 Kb. Exceeding the limit should raise an exception. However when using my BasexCpp library on a fast machine with a lot of memory, I can add successfuly a file, sized 358 kB, with one add-message. Adding the same file to a basexserver on a remote, slow machine, results in a crash. Neither the local nor remote console report a message.
I downloaded the Basex-sources and found in org.basex.core.cmd/Add.java that the cache() function may use a ADDCACHE option. Since the memory size of the server is limited, I wondered if setting this option might force the server to explicitly use a disk-cache.
Does the Basex server protocol offers any features for setting this option?
I have been collecting information on websocket programming and learned a lot on handshaking, maaual paring, framing, event-loops and other concepts. My guess is that most is not very helpfull. Does anyone have good sugestions for relevant information?
Ben
Hi Ben,
WebSockets are part of the BaseX HTTP architecture (specifically with Jetty; Tomcat is not supported yet). There is no relationships between the existing language client bindings and WebSockets.
Hope this helps, Christian
Quoted text · Ben Engbers · 27 lines
Von: Ben Engbers via BaseX-Talk <basex-talk at mailman.uni-konstanz.de> Gesendet: Donnerstag, Februar 12, 2026 3:51:28 PM An: Basex Mail-lijst <basex-talk at mailman.uni-konstanz.de> Betreff: [basex-talk] Max message size in Websockets exceeded? Hi, According to "https://docs.basex.org/11/WebSockets", the default limit for messages is 64 Kb. Exceeding the limit should raise an exception. However when using my BasexCpp library on a fast machine with a lot of memory, I can add successfuly a file, sized 358 kB, with one add-message. Adding the same file to a basexserver on a remote, slow machine, results in a crash. Neither the local nor remote console report a message. I downloaded the Basex-sources and found in org.basex.core.cmd/Add.java that the cache() function may use a ADDCACHE option. Since the memory size of the server is limited, I wondered if setting this option might force the server to explicitly use a disk-cache. Does the Basex server protocol offers any features for setting this option? I have been collecting information on websocket programming and learned a lot on handshaking, maaual paring, framing, event-loops and other concepts. My guess is that most is not very helpfull. Does anyone have good sugestions for relevant information? Ben -- Ben Engbers Grietjeshof 77 6721 VH Bennekom +31 6 23634840
Hi Christiaan,
Several years ago I started out using the sample C code from the client written by the Basex team as a starting point. And I always assumed that that code used a websocket. As far as I understand now, my current code uses a raw TCP connection. And I need to convert that connection to one based on the WebSocket protocol. I asked chat.mistral.ai how to do that and found lots of sample code there. So it should be sorted out any day now.
I was wondering what you mean by the following sentence: There is no relationship between the existing language client bindings and WebSockets.
What do you mean by that?
Ben
Hi Ben,
Quoted text · Ben Engbers · 1 line
> I asked chat.mistral.ai how to do that and found lots of sample code there. So it should be sorted out any day now.
Great.
Quoted text · Ben Engbers · 1 line
> I was wondering what you mean by the following sentence: There is no relationship between the existing language client bindings and WebSockets.
I referred to the client implementations that we listed in our documentation [1]. None of them have HTTP capabilities, including support for WebSockets.
Hope this helps, Christian
Quoted text · Ben Engbers · 6 lines
On Thu, 12 Feb 2026 15:50:36 +0100 Ben Engbers via BaseX-Talk <basex-talk at mailman.uni-konstanz.de> wrote: > I have been collecting information on websocket programming and > learned a lot on handshaking, maaual paring, framing, event-loops and > other concepts. My guess is that most is not very helpfull. > Does anyone have good sugestions for relevant information?
What are you actually trying to achieve?
WebSockets are a means to an end, and are (slightly) higher level than C TCP connections, but not much higher. But they are good for two-way traffic from e.g. JavaScript, as long as you are careful to avoid deadlock of course.
And in what environment are you doing this? E.g. network programming in C or even Rust on Linux is not the same as python or JavaScript or trying to build federated XQuery servers or JETTY :-)
liam
Written for BaseX 12.2. BaseX may have changed since: please check the current documentation.