Firebase database looses websocket connection which results in delays

纵饮孤独 提交于 2019-12-04 07:35:45

After some trial and research (#1, #2), we have found a "workaround" that prevents the delay:

import {INTERNAL as firebaseDbInternal} from '@firebase/database'

// Force firebase database to use long polling instead of websockets
firebaseDbInternal.forceLongPolling()

Warning: This does not seem to be a good solution, because a comment in internal.ts states:

Customers shouldn't use these (functions) or else should be aware that they could break at any time.

We would be happy for suggestions on a better solution - as long as there is no better answer, I will accept this answer as the best approach to solve the problem.

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!