通过websocket在Web浏览器和python之间进行大量交换来阻止浏览器(Blocking browser with huge exchange between Web browser and

编程入门 行业动态 更新时间:2024-10-13 06:15:18
通过websocket在Web浏览器和python之间进行大量交换来阻止浏览器(Blocking browser with huge exchange between Web browser and python through websocket)

我使用websocket在python下的Raspberry Pi上的Robot和使用html,js和jquery的web浏览器应用程序之间进行交换。 机器人给出其角度位置来自磁力计芯片,以及webbrowser显示机器人方向。 WebBrowser按秒接收至少5条消息,然后阻止。 如何为浏览器提供一些“呼吸”以避免这种情况? 最好的祝福

I use websocket for exchange between Robot on Raspberry Pi under python, and web browser application with html, js and jquery. Robot gives its angular position coming from magnetometer chip, and webbrowser display robot direction. WebBrowser receives at least 5 messages by second, and block. How to gives some "breathes" to the browser to avoid that ? Best regards

最满意答案

要避免在浏览器中阻止行为,您需要清除事件循环中的一些空间。 有关这方面的详细解释,您可以查看此视频: https : //www.youtube.com/watch?v = 8aGhZQkoFbQ

解释会发生什么:您的浏览器被阻止处理数据,它需要“喘息空间”来直观地重新绘制已发生的变化。 如果你分解数据流并使用一些setTimeout,你可以在浏览器之间给出“呼吸”时间。 希望它能帮到你!

To avoid blocking behaviour in the browser you need to clear up some space in the event loop. For a good explanation of that, you can check out this video: https://www.youtube.com/watch?v=8aGhZQkoFbQ

To explain what happens: Your browser is blocked processing data, and it needs 'breathing space' to repaint visually the changes that have happened. If you break up the data flow and use some setTimeout's you give your browser time in between to 'breathe'. Hope it helps you!

更多推荐

本文发布于:2023-08-04 21:16:00,感谢您对本站的认可!
本文链接:https://www.elefans.com/category/jswz/34/1422662.html
版权声明:本站内容均来自互联网,仅供演示用,请勿用于商业和其他非法用途。如果侵犯了您的权益请与我们联系,我们将在24小时内删除。
本文标签:浏览器   换来   python   websocket   Web

发布评论

评论列表 (有 0 条评论)
草根站长

>www.elefans.com

编程频道|电子爱好者 - 技术资讯及电子产品介绍!