Read entire body of request

2 views
Skip to first unread message

Timothy Reaves

unread,
May 19, 2016, 9:12:57 AM5/19/16
to Tufão
I'd having an issue that doesn't seem to have a good solution.

I need to read the body of a request to get the JSON payload.  When I do this locally (the server running on the same machine as the web browser), request.readyBody() works just fine.  When the server is on a machine where there is a bit of network latency, readyBody() only returns part of the body.  This is understandable.  However, trying to use the end() signal isn't working, because locally, the signal is sent before the connect completes, and therefor 'hangs' (using a lambda).  

A better solution would be for there to be a readBodyFull() on request, where Tufao itself could handle this better.

Any ideas?  Thanks.

Vinícius dos Santos Oliveira

unread,
Jun 10, 2016, 6:18:25 AM6/10/16
to Tufão
2016-05-19 10:12 GMT-03:00 Timothy Reaves <tre...@silverfieldstech.com>:
However, trying to use the end() signal isn't working, because locally, the signal is sent before the connect completes, and therefor 'hangs' (using a lambda).

I didn't understand this part. Could you elaborate on that?

And sorry about the delay, my time to hobby projects has been limited recently. Now I'm on a 5 days vacation and I should have time to work on that for now (I also released two new Tufão maintenance releases).

--
Vinícius dos Santos Oliveira

Timothy Reaves

unread,
Jun 10, 2016, 10:40:23 AM6/10/16
to tu...@googlegroups.com
When I try & use the end signal with a closure, and the server is running on the same machine I’m connecting from (i.e. on my development laptop), the end signal is sent before the connect in my code even has a chance to be called.  The amount of data is small, so seems to complete before my code is even reached.  The end signal is then never received, and the app hangs.

I think probably the best thing here is for the framework to have a ‘readAll’ or some-such, for use when the expected amount of data is within acceptable memory consumption.  That way the user doesn’t need to deal with callback, closures, etc.  


--
You received this message because you are subscribed to a topic in the Google Groups "Tufão" group.
To unsubscribe from this topic, visit https://groups.google.com/d/topic/tufao/hrresjIcwvM/unsubscribe.
To unsubscribe from this group and all its topics, send an email to tufao+un...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Vinícius dos Santos Oliveira

unread,
Jun 10, 2016, 12:39:34 PM6/10/16
to Tufão
2016-06-10 11:40 GMT-03:00 Timothy Reaves <tre...@silverfieldstech.com>:
The end signal is then never received, and the app hangs.

I think I'm starting to understand what you're saying.

Which Tufão version are you using? Are you using the router?

I need to think about that. Sounds a complicated issue. Did you find some workaround?
Reply all
Reply to author
Forward
0 new messages