最新消息:雨落星辰是一个专注网站SEO优化、网站SEO诊断、搜索引擎研究、网络营销推广、网站策划运营及站长类的自媒体原创博客

javascript - Do SSE and Websockets work when the browser is in the background? - Stack Overflow

programmeradmin1浏览0评论

Both SSE (Server Sent events) and Websockets allow real-time messaging from a server to a client.

Do these stream protocol work when the browser is in the background and another programs are in focus, especially in mobile browsers?

Both SSE (Server Sent events) and Websockets allow real-time messaging from a server to a client.

Do these stream protocol work when the browser is in the background and another programs are in focus, especially in mobile browsers?

Share Improve this question asked Mar 19, 2014 at 12:03 Adam MatanAdam Matan 137k155 gold badges412 silver badges580 bronze badges
Add a ment  | 

2 Answers 2

Reset to default 3

Yes. At least WebSocket.

Open this demo in browser 1, click on "open 2nd instance", copy the link to browser 2, put browser 1 to background and click "publish" in browser 2.

The demo will work on Chrome for Mobile (on Android) also. I have just tested: it'll receive messages a) when switching to another tab, and then switch back, and also b) if you open another activity (app), and then return to Chrome.

You can also try the other demos. Other than audio output with the "beatbox demo", everything will work on Chrome Mobile. Note that with the "beatbox demo", you can still use the smartphone as a controller .. it's just the audio output which has issues.

Disclaimer: I am original author of Crossbar.io and work for Tavendo.

Not on all platforms. According to Keep WebSocket alive in Mobile Safari it is not possible in mobile safari.

发布评论

评论列表(0)

  1. 暂无评论