As the title says... Chat on...

User avatar
By Sille
#58407 Hey Marcel

thx for your reply I saw some interesting stuff from you in the last few days :) The reason why I´m using this module was that the heap size isn´t decreasing when I do multiple requests to my webserver. How I said I have to send the data in chunks but I´m not really experienced I´m just learning at the moment but I think there is a progress :)

In this case I keep the connection alive for 100 hundred sends then server shuts down the connection but I need some more so I have to reconnect. Maybe I should give websockets or mqqt a try to stream the data to a server. Can you give me a recomendation beside using the http-module or an advice how I can prevent running out of heap in order to prevent a restart? thank you very much!

best

Sille
User avatar
By marcelstoer
#58417 I don't have enough time to debug your script, sorry.

To decouple client from server, MQTT is a valid approach that's true. You'd be introducing an extra dependency though (MQTT broker). So, think twice if you really want that. To continuously "stream" data websockets may be a good idea but that again comes with some extra complexity (websocket server).

With our HTTP module you can send a few KB per POST request and I'm not aware of any memory leaks - at least not in recent firmware versions.

As for how to properly send large chunks of data with the net module have a look at the blueprint in the documentation for net.socket:send().
Last edited by marcelstoer on Thu Nov 24, 2016 5:44 am, edited 1 time in total.
User avatar
By Sille
#58610 hey Marcel,

thank you for your suggestions. I had to set up a server by my own because the data should be processed in a local network I´m very interested to try some things. To create a websocket is more complex than using a php-server on apache? Can you point out some problems please?
In the meanwhile I changed GET to POST request I took this into account earlier but I failed to get this work. Now I´m struggling with a new problem. I moved the conn:send() command to the event "received". On every "received" the module is firing a chunk of data but my apache is not progressing every data package. I figured out that the problem is my php code. When data is arrived my server take the arrived string and put them into the data file. In the meanwhile data arrives again which is not processed until the file is closed or the previous step is finished. I thought about to wait for the payload because this is the sign that the server is done. Is this a common problem or are there other solutions for this?
From time to time I get an error which says that the payload size expected should be <1460 what does that mean? I thought POST data is not restricted by the string length or size?

Best regards

Sille
User avatar
By Frank Buss
#64978 Regarding your problem with too long strings: the message you got probably was "string length overflow". The reason is that the default max string length is only 4096 bytes. You can change this at runtime, e.g. increase it to 8192 bytes:
Code: Select allcollectgarbage("setmemlimit", 8)