将Java WebSocket插入Firebase? [英] Javascript WebSocket into Firebase?

查看:58
本文介绍了将Java WebSocket插入Firebase?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

是否可以使用标准的 WebSocket 来访问Firebase数据库,而不使用其库.具体来说,我想仅使用普通javascript访问firebase实时数据库.那可行吗?

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?

推荐答案

在大多数现代浏览器中,Firebase客户端通过Web套接字与其后端进行通信.但是它使用的有线协议是未记录的,并且可能会随时间而变化.再说一次,您可以研究开源JavaScript SDK ,以便对它是如何在引擎盖下工作的.

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.

或者,您可以在 Firebase REST API的顶部构建自定义客户端库,该文件已被完整记录.它支持从REST API进行流传输 ,这将为您提供Web Socket实现的许多优点,而无需依赖未公开的协议.

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.

这篇关于将Java WebSocket插入Firebase?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆