Firebase .NET 访问
声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow
原文地址: http://stackoverflow.com/questions/10729878/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me):
StackOverFlow
Firebase .NET access
提问by Derek
If I want to use Firebase now from .NET in C#, what is your suggestion as the best way to handle the callbacks? I see your current client library is using WebSockets. Can you offer a small example of how best to set this up in C#?
如果我现在想在 C# 中从 .NET 使用 Firebase,您有什么建议作为处理回调的最佳方式?我看到您当前的客户端库正在使用 WebSockets。你能举一个小例子来说明如何最好地在 C# 中进行设置吗?
回答by Michael Lehenbauer
Right now the only option is to interface with Firebase through the REST api. This will not give you real-time data updates, but you can read and write to Firebase. For instance, it would be very suitable for an ASP.Net backend to use the REST API to broadcast data to clients which are using the JavaScript client.
现在唯一的选择是通过REST api与 Firebase 交互。这不会为您提供实时数据更新,但您可以读取和写入 Firebase。例如,非常适合 ASP.Net 后端使用 REST API 向使用 JavaScript 客户端的客户端广播数据。
As for a full C# client equivalent to the JavaScript client (capable of syncing data and receiving realtime updates), that unfortunately isn't feasible right now. The wire protocol used within the WebSocket isn't documented or stable, and the guts of the client code are actually pretty gnarly. We're hoping to release a spec in the future so people can write more clients, but it's changing too frequently right now. Sorry!
至于等效于 JavaScript 客户端的完整 C# 客户端(能够同步数据和接收实时更新),不幸的是,目前尚不可行。WebSocket 中使用的有线协议没有记录或稳定,客户端代码的内容实际上非常粗糙。我们希望在未来发布一个规范,这样人们就可以编写更多的客户端,但现在它的变化太频繁了。对不起!

