As I have no real experience in how to do these things I'm just inquiring about possible best practice. From posts on the forum I understand that my problem probably is due to fragmentation of memory so that there is no 8kB of consecutive memory available.
- To reduce my html string, I was thinking that I should put the java scripts and style sheet in separate files that gets called from my html file (like I would on an apache server) but I have not found how to do this with my websocket in micropython.
- As an alternative to the above, I also wonder if it would be better (since my visible page is quite small) to move the javascript logic to the python code instead to reduce the html string accordingly.
- But I would like to keep the use of js ajax to get the updated sensor readings (so I don't get a flickering web page). Is this polling a likely source of the problem. My own testing is very inconclusive.
- The relay itself gets updated periodically with a machine.timer. Is this something that can clash with the websocket handler?
Any advice or pointers would be much appreciated.
/Fredrik