Find centralized, trusted content and collaborate around the technologies you use most.
Teams
Q&A for work
Connect and share knowledge within a single location that is structured and easy to search.
在我的事件页面的初始化中,我想通过Socket.IO创建一个 WebSockets 连接,并在数据进入该连接时唤醒页面。
我怀疑这是不可能的,我将不得不使用背景页面,但是有什么聪明的方法可以使用事件页面来代替,这样我就不会让我的用户受到性能打击?
我很确定您不能仅仅因为事件页面被设计为在不使用时卸载。每当页面卸载时,它将关闭所有 WebSocket 连接。如果它永远不会卸载,那么您实际上拥有一个持久的背景页面。