Javascript WebSocket into Firebase?

僤鯓⒐⒋嵵緔 提交于 2020-07-20 08:22:33

问题


Is it possible to use standard WebSocket's to access a Firebase database instead of using their library. Specifically, I want to access the firebase real-time database using only vanilla javascript. Is that even feasible?


回答1:


In most modern browsers the Firebase client communicates with its back-end over web sockets. But the wire protocol it uses is not documented, and may change over time. Then again, you could study the open-source JavaScript SDK to get a pretty good idea of how it works under the hood.

Alternatively, you could build your custom client library on top of the Firebase REST API, which is fully documented. It includes support for Streaming from the REST API, which gets you many of the advantages of the Web Socket implementation without relying on an undocumented protocol.



来源:https://stackoverflow.com/questions/48734290/javascript-websocket-into-firebase

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