Bug #7788
openSignal with big string does not trigger the fallback function
0%
Description
Context :
I want to get back from the client a dynamic picture (openlayer map) as text ("data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAA...")
How I did:
I use a signal and a slot to retrieve the data from the image as text with some JS with the slot.setJavaScript(...)
Then the dispatch function(std::string) does his work with the received string.
Problem :
It works with a small string (or integer and other types).
It does not work with a big string. The signal is emitted (a POST request with the whole data is sent from the client to the server), but the dispatch function is not reached.
Is there a std::string limitation within Wt ?
compiled with Wt 4.4.0
Updated by Samuel Quevauvillers about 4 years ago
After some tries, it blocks the request if the text length is between 120 000 and 122 500 chars.
(precision, it's it JSlignal and JSlot)
Updated by Roel Standaert about 4 years ago
Between? So you mean that when it's over 112500 chars it does work?
There is a request size limitation (<max-request-size>
in wt_config.xml
), and a form data size limitation (<max-formdata-size>
).
I think that a WResource
may be more appropriate though?
Updated by Samuel Quevauvillers about 4 years ago
Sorry I mean it will work if under 120 000 and won't if greater than 122500, I don't know the exact limit, I was trying to find it out to be able to get a tip;
As this is a POST request I will try the <max-formdata-size>
on monday, thanks for the tip.
How should a WResource could work ? does it will work from client to server ?
Updated by Roel Standaert about 4 years ago
You will also need to make sure <max-request-size>
is large enough. Both max-request-size
and max-formdata-size
apply here.
With WResource
there's a bit more work involved. You'd have to create a WResource
, implement its handleRequest
function, and then on the client side actually execute the necessary JavaScript to send a POST request to that resource.
Updated by Samuel Quevauvillers about 4 years ago
Well the <max-request-size>
and <max-formdata-size>
did not resolve my problem...
I will try the WResource way. Do you have example on how generate the POST request ? Should I make my own ajax post request ? The doc about WResource is quite small...
Thank you
Updated by Samuel Quevauvillers about 4 years ago
WResource was too much time consuming to implement...
I did not find a good example to handle requests + WRresource.
So I used a workaround, as I can get a fixed number of string size working, I split the whole data by sending in several chunk. And worked...