问题
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