google calendar 不同网页端怎么做到同步的
資深大佬 : henryliufeng 7
打开两个 google calendar 网页端,我创建一个事件,另一个网页端很快就同步过来了
看了下,没有建立 websocket 链接, 求大佬指点,是怎么做到接近实时同步的
大佬有話說 (20)
打开两个 google calendar 网页端,我创建一个事件,另一个网页端很快就同步过来了
看了下,没有建立 websocket 链接, 求大佬指点,是怎么做到接近实时同步的
或者 localStorage(代码来自 [segmentfault]( https://segmentfault.com/a/1190000016927268))
“`
// 本窗口的设值代码
localStorage.setItem(‘aaa’, (Math.random()*10).toString())
// 其他窗口监听 storage 事件
window.addEventListener(“storage”, function (e) {
console.log(e)
console.log(e.newValue)
})
“`
ack 那东西 参考 https://cloud.google.com/pubsub/docs/reference/rest/v1/projects.subscriptions/acknowledge
然后你就可以去看看 pubsub google 是怎么搞的了