firebase / firebase/firebase-cpp-sdk

Unable to establish WebSocket connection with Firebase C++ SDK

未关闭
#1,261 4 条评论 0 个 reaction 已指派 0 人 在 GitHub 查看
api: database needs-attention type: question
主要语言
C++
星标
326
派生
137
平均合并
3 天 9 小时
30 天内合并 PR
5

描述

### [REQUIRED] Please fill in the following fields:
* Pre-built SDK from the [website](https://firebase.google.com/download/cpp) or open-source from this repo: Open-source from this repo
* Firebase C++ SDK version: 10.7.0
* Main Firebase Components in concern: Auth
* Other Firebase Components in use: Database
* Platform you are using the C++ SDK on: Linux
* Platform you are targeting: Desktop

### [REQUIRED] Please describe the question here:

#### Expected behavior:

I expect to be able to establish a WebSocket connection using the Firebase C++ SDK and receive real-time updates of the database.

#### Actual behavior:

The WebSocket connection fails to establish using the Firebase C++ SDK, but a simple WebSocket client I wrote could build a secure connection (wss) to a public websocket server on the same device. The Firebase Realtime Database REST API connection works without any issues.

#### Description:
I am experiencing an issue with the Firebase C++ SDK, where I am unable to establish a WebSocket connection to the Firebase Realtime Database server. Here is the log message:
```
DEBUG: [conn_1170] websocket error occurred. Uri: wss://....firebaseio.com/.ws?ns=...&v=5
DEBUG: Error occurred while establishing connection to wss://....firebaseio.com/.ws?ns=...&v=5
DEBUG: [conn_1170] Closing connection. Reason: 4
DEBUG: [pc_0] Got on disconnect due to 4
```
However, when I tested the connection using a simple WebSocket client I wrote on the same device, it was able to connect successfully. So it might not be a router's firewall setting issue.

I also tested the connection using the Firebase Realtime Database REST API with the same credential by doing
```bash
$ curl "https://....firebaseio.com/.../msg.json?auth=$(cat token)"

```
and it worked without any issues. This suggests that the issue is specific to the WebSocket functionality of the Firebase C++ SDK.

I have checked my code for any errors or issues and ensured that I am using the correct credentials and endpoint URLs. I am using the latest version of the Firebase C++ SDK, and have followed the documentation provided by Firebase.

贡献指南

打开贡献指南

调研方向

未指定源文件或测试。首先跟踪 Linux 上的 Firebase Realtime Database WebSocket 连接,并将其失败情况与正常工作的 REST 请求和独立安全 WebSocket 客户端进行比较。完成的标准是确定 SDK 特有的原因,并建立连接以接收实时数据库更新。

由索引模型根据 Issue 内容生成。

评估

技术栈
cpp
领域
databases, networking
Issue 类型
缺陷
难度
4/5
预计耗时
3-5 天
活跃度
停滞
描述清晰度
需要澄清
新手友好度
25/100

把新 issue 发到你的邮箱

精选适合新手参与的 GitHub issue 摘要。