lobehub / lobe-chat

🤯 Lobe Chat - an open-source, modern-design AI chat framework. Supports Multi AI Providers( OpenAI / Claude 3 / Gemini / Ollama / Azure / DeepSeek), Knowledge Base (file upload / knowledge management / RAG ), Multi-Modals (Vision/TTS) and plugin system. One-click FREE deployment of your private ChatGPT/ Claude application.
https://chat-preview.lobehub.com
Other
44.93k stars 10.11k forks source link

WebRTC Data Sync Feedback #1683

Closed arvinxx closed 4 months ago

arvinxx commented 8 months ago

We use this issue to track all WebRTC relative data sync issue

我们使用本 issue 来跟踪所有数据同步相关的问题,任何和数据同步相关的问题,请在此问题下记录

coulsontl commented 8 months ago

使用Docker部署的应用,然后NGINX反代;在同一台电脑上开多个窗口,多个窗口之间的确可以同步,但是2个不同的设备(电脑和手机)都显示已连接,但是不会同步。已确认频道名称和密码都是一样的。

lobehubbot commented 8 months ago

Bot detected the issue body's language is not English, translate it automatically. 👯👭🏻🧑‍🤝‍🧑👫🧑🏿‍🤝‍🧑🏻👩🏾‍🤝‍👨🏿👬🏿


Use Docker to deploy applications, and then use NGINX to reverse generation; open multiple windows on the same computer, and the multiple windows can indeed be synchronized, but two different devices (computer and mobile phone) are displayed as connected, but will not be synchronized. . Confirmed that the channel name and password are the same.

linth2005 commented 8 months ago

不太理解,为什么同步需要两个设备同时在线,如果一个是公司电脑,一个是家里电脑,这个场景下就无法使用功能同步呀

lobehubbot commented 8 months ago

Bot detected the issue body's language is not English, translate it automatically. 👯👭🏻🧑‍🤝‍🧑👫🧑🏿‍🤝‍🧑🏻👩🏾‍🤝‍👨🏿👬🏿


I don’t quite understand why synchronization requires two devices to be online at the same time. If one is a company computer and the other is a home computer, functional synchronization cannot be used in this scenario.

arvinxx commented 8 months ago

不太理解,为什么同步需要两个设备同时在线

这个是和 WebRTC 本身的通信特性有关系,由于目前的技术选型(纯前端、无服务端)的情况下,两个设备的数据同步只能通过点对点通信的形式达成。当一个设备在线,一个设备离线的情况下,我们无从感知数据到底应该从哪来,只有当两台设备都在线的时候,双发数据才能通信。

其实这种模式更像是一个在线聊天室,大家都在线时才能看到对方的数据,然后达成同步。

如果一个是公司电脑,一个是家里电脑,这个场景下就无法使用功能同步呀

是的,你说的没错,那这也我实现完这个功能之后发现的问题。WebRTC 这种纯点对点的方式在某些情况下并无法完全满足用户的诉求,同时也存在一些数据同步层面的问题。这也是我认为这个功能目前也仅算是「实验」的原因。

但是这个模式最大的意义,是让我确信,基于 YJS 我们可以很轻松地实现跨端的数据同步,至于 WebRTC,只是达成同步的一个模式而已 。而我们未来更进一步的,则是在 YJS 这个同步引擎基础上,引入更多的服务端存储层,例如 基于 Redis 的 Upstash 、MongoDB 、甚至于 S3 、文件系统等等。而到这个时候,就是我们的云同步体验达到完美的阶段。

lobehubbot commented 8 months ago

Bot detected the issue body's language is not English, translate it automatically. 👯👭🏻🧑‍🤝‍🧑👫🧑🏿‍🤝‍🧑🏻👩🏾‍🤝‍👨🏿👬🏿


I don’t quite understand why synchronization requires two devices to be online at the same time.

This is related to the communication characteristics of WebRTC itself. Due to the current technology selection (pure front-end, no server), data synchronization between two devices can only be achieved through point-to-point communication. When one device is online and the other is offline, we have no way of knowing where the data should come from. Only when both devices are online can dual-send data communicate.

In fact, this model is more like an online chat room. Only when everyone is online can they see each other's data and then achieve synchronization.

If one is a company computer and the other is a home computer, function synchronization cannot be used in this scenario.

Yes, you are right, then this is also a problem I discovered after implementing this function. The purely point-to-point approach of WebRTC cannot fully meet the needs of users in some cases, and there are also some data synchronization issues. This is why I think this feature is only an "experiment" at the moment.

But the greatest significance of this model is that it convinces me that based on YJS we can easily achieve cross-end data synchronization. As for WebRTC, it is just a model for achieving synchronization. What we will go one step further in the future is to introduce more server-side storage layers based on the YJS synchronization engine, such as Redis-based Upstash, MongoDB, and even S3, file systems, etc. By this time, our cloud synchronization experience has reached the perfect stage.

arvinxx commented 8 months ago

使用Docker部署的应用,然后NGINX反代;在同一台电脑上开多个窗口,多个窗口之间的确可以同步,但是2个不同的设备(电脑和手机)都显示已连接,但是不会同步。已确认频道名称和密码都是一样的。

@coulsontl 有没有试过换一个网络呀

lobehubbot commented 8 months ago

Bot detected the issue body's language is not English, translate it automatically. 👯👭🏻🧑‍🤝‍🧑👫🧑🏿‍🤝‍🧑🏻👩🏾‍🤝‍👨🏿👬🏿


Use the application deployed by Docker, and then use NGINX to reverse the generation; open multiple windows on the same computer, and the multiple windows can indeed be synchronized, but two different devices (computer and mobile phone) show that they are connected, but they will not Synchronize. Confirmed that the channel name and password are the same.

@coulsontl Have you tried changing the network?

coulsontl commented 8 months ago

使用Docker部署的应用,然后NGINX反代;在同一台电脑上开多个窗口,多个窗口之间的确可以同步,但是2个不同的设备(电脑和手机)都显示已连接,但是不会同步。已确认频道名称和密码都是一样的。

@coulsontl 有没有试过换一个网络呀

试过,不行

lobehubbot commented 8 months ago

Bot detected the issue body's language is not English, translate it automatically. 👯👭🏻🧑‍🤝‍🧑👫🧑🏿‍🤝‍🧑🏻👩🏾‍🤝‍👨🏿👬🏿


Use the application deployed by Docker, and then use NGINX to reverse the generation; open multiple windows on the same computer, and the multiple windows can indeed be synchronized, but two different devices (computer and mobile phone) show that they are connected, but they are not connected. will be synchronized. Confirmed that the channel name and password are the same.

@coulsontl Have you tried changing the network?

Tried, doesn't work

ccdanpian commented 8 months ago

使用Docker部署的应用,然后NGINX反代;在同一台电脑上开多个窗口,多个窗口之间的确可以同步,但是2个不同的设备(电脑和手机)都显示已连接,但是不会同步。已确认频道名称和密码都是一样的。

@coulsontl 有没有试过换一个网络呀

试过,不行

和我的情况不太一样,我是分别用vercel和本地docker部署的: 在PC上把vercel和本地docker的都打开,这两个之间可以同步; 手机用自己sim卡上网的时候,无法和PC同步; 手机网络换成和PC一样的WIFI,可以合PC同步

lobehubbot commented 8 months ago

Bot detected the issue body's language is not English, translate it automatically. 👯👭🏻🧑‍🤝‍🧑👫🧑🏿‍🤝‍🧑🏻👩🏾‍🤝‍👨🏿👬🏿


Use the application deployed by Docker, and then use NGINX to reverse the generation; open multiple windows on the same computer, and the multiple windows can indeed be synchronized, but two different devices (computer and mobile phone) show that they are connected, but Will not sync. Confirmed that the channel name and password are the same.

@coulsontl Have you tried changing the network?

Tried, doesn’t work

The situation is different from mine. I deployed it using vercel and local docker respectively: Open both vercel and local docker on the PC, and the two can be synchronized; When the mobile phone uses its own SIM card to access the Internet, it cannot synchronize with the PC; Change the mobile network to the same WIFI as the PC, and you can synchronize it with the PC

ccdanpian commented 8 months ago

问题:现在是指同步聊天记录,不会同步设置里的配置参数吗?

lobehubbot commented 8 months ago

Bot detected the issue body's language is not English, translate it automatically. 👯👭🏻🧑‍🤝‍🧑👫🧑🏿‍🤝‍🧑🏻👩🏾‍🤝‍👨🏿👬🏿


Question: Now it means synchronizing chat records, but will it not synchronize the configuration parameters in the settings?

arvinxx commented 8 months ago

问题:现在是指同步聊天记录,不会同步设置里的配置参数吗?

目前没加这个,设置你需要同步吗?

lobehubbot commented 8 months ago

Bot detected the issue body's language is not English, translate it automatically. 👯👭🏻🧑‍🤝‍🧑👫🧑🏿‍🤝‍🧑🏻👩🏾‍🤝‍👨🏿👬🏿


Question: Now it refers to the synchronization of chat records, but will it not synchronize the configuration parameters in the settings?

This is not added currently. Do you need to synchronize the settings?

ccdanpian commented 8 months ago

问题:现在是指同步聊天记录,不会同步设置里的配置参数吗?

目前没加这个,设置你需要同步吗?

需要,今天就遇到这个问题,在电脑的openrouter里加了好几个自选模型,手机上也还要再加一次。

lobehubbot commented 8 months ago

Bot detected the issue body's language is not English, translate it automatically. 👯👭🏻🧑‍🤝‍🧑👫🧑🏿‍🤝‍🧑🏻👩🏾‍🤝‍👨🏿👬🏿


Question: Now it refers to the synchronization of chat records, but will it not synchronize the configuration parameters in the settings?

This is not added yet. Do you need to synchronize the settings?

Yes, I encountered this problem today. I added several self-selected models to the openrouter on my computer, and I have to add them again on my mobile phone.

saccohuo commented 8 months ago

docker部署的。手机和PC不在同一个网络。 配置完后,点击“开启云端同步”没有反应。设置页已经enable了同步功能,但是还是显示的同步未开启。

lobehubbot commented 8 months ago

Bot detected the issue body's language is not English, translate it automatically. 👯👭🏻🧑‍🤝‍🧑👫🧑🏿‍🤝‍🧑🏻👩🏾‍🤝‍👨🏿👬🏿


Deployed by docker. The phone and PC are not on the same network. After configuring, there is no response when clicking "Turn on cloud synchronization". The synchronization function has been enabled on the settings page, but it still shows that synchronization is not enabled.

xaya1001 commented 8 months ago

同样电脑和手机不能同步,但是两台家里电脑和公司电脑之间能同步,本想通过手机作为中介来同步两台电脑的,结果不行。 我还想过在服务器上运行一个firefox浏览器(jlesage/firefox),作为一个永不下线的终端,结果也不能同步。

lobehubbot commented 8 months ago

Bot detected the issue body's language is not English, translate it automatically. 👯👭🏻🧑‍🤝‍🧑👫🧑🏿‍🤝‍🧑🏻👩🏾‍🤝‍👨🏿👬🏿


Similarly, computers and mobile phones cannot be synchronized, but two home computers and work computers can be synchronized. I wanted to use mobile phones as an intermediary to synchronize the two computers, but it didn't work. I also thought about running a firefox browser (jlesage/firefox) on the server. As a terminal that never goes offline, the results cannot be synchronized.

Chidoudou commented 8 months ago

image 手机和电脑均显示已同步,但是还是只能看到各自的聊天记录

TonyBlur commented 8 months ago

image 手机和电脑均显示已同步,但是还是只能看到各自的聊天记录

我也是,目前还没测试过连同一个网络能否正常同步,但是电脑wifi 手机数据的情况下是无法正常同步的

lobehubbot commented 8 months ago

Bot detected the issue body's language is not English, translate it automatically. 👯👭🏻🧑‍🤝‍🧑👫🧑🏿‍🤝‍🧑🏻👩🏾‍🤝‍👨🏿👬🏿


image Both the mobile phone and the computer show that they have been synchronized, but you can still only see their respective chat records.

Me too, I haven't tested whether it can be synchronized normally with a network, but it cannot be synchronized normally when using computer wifi and mobile phone data.

arvinxx commented 8 months ago

需要,今天就遇到这个问题,在电脑的openrouter里加了好几个自选模型,手机上也还要再加一次。

@ccdanpian 这个点,能麻烦你单开一个 issue 跟踪吗?

lobehubbot commented 8 months ago

Bot detected the issue body's language is not English, translate it automatically. 👯👭🏻🧑‍🤝‍🧑👫🧑🏿‍🤝‍🧑🏻👩🏾‍🤝‍👨🏿👬🏿


Yes, I encountered this problem today. I added several self-selected models to the openrouter on my computer, and I have to add them again on my mobile phone.

@ccdanpian Could you please open a separate issue for tracking?

MapleEve commented 8 months ago

https://github.com/lobehub/lobe-chat/issues/1724

放一个奇怪的现象,主要是不同设备同时在线频道里面都看不全谁在线,而且状态也不是已同步而是已连接

lobehubbot commented 8 months ago

Bot detected the issue body's language is not English, translate it automatically. 👯👭🏻🧑‍🤝‍🧑👫🧑🏿‍🤝‍🧑🏻👩🏾‍🤝‍👨🏿👬🏿


https://github.com/lobehub/lobe-chat/issues/1724

There is a strange phenomenon, mainly because different devices are online at the same time. In the channel, it is not possible to see who is online, and the status is not synchronized but connected.

ccdanpian commented 8 months ago

需要,今天就遇到这个问题,在电脑的openrouter里加了好几个自选模型,手机上也还要再加一次。

@ccdanpian 这个点,能麻烦你单开一个 issue 跟踪吗?

@arvinxx 已新提https://github.com/lobehub/lobe-chat/issues/1725

lobehubbot commented 8 months ago

Bot detected the issue body's language is not English, translate it automatically. 👯👭🏻🧑‍🤝‍🧑👫🧑🏿‍🤝‍🧑🏻👩🏾‍🤝‍👨🏿👬🏿


Yes, I encountered this problem today. I added several self-selected models to the openrouter on my computer, and I have to add them again on my mobile phone.

@ccdanpian Could you please open a separate issue for tracking?

@arvinxx has newly mentioned https://github.com/lobehub/lobe-chat/issues/1725

BrandonStudio commented 8 months ago

Redis-based Upstash

话说都Vercel了,直接用Vercel的Redis呗(

arvinxx commented 8 months ago

话说都Vercel了,直接用Vercel的Redis呗(

也不是不行hhh

1PercentSync commented 8 months ago

在不同网络下无法同步,即使使用了tailscale也不行,是否可以手动指定一个ip,目前获取的是访问服务器的ip吗

lobehubbot commented 8 months ago

Bot detected the issue body's language is not English, translate it automatically. 👯👭🏻🧑‍🤝‍🧑👫🧑🏿‍🤝‍🧑🏻👩🏾‍🤝‍👨🏿👬🏿


It cannot be synchronized under different networks, even if tailscale is used. Is it possible to manually specify an IP? Is the IP currently obtained to access the server?

zhairuoxun commented 8 months ago

用docker部署的lobehub无法在局域网打开同步。 我在一台主机上用docker部署了lobechat,然后通过其它设备用内网访问ip,结果发现部署lobechat的主机可以开启同步功能,但是在别的主机上的同步功能却无法开启。

具体表现为:尽管云端同步的“开启同步”按钮是打开的,却一直显示同步未开启

lobehubbot commented 8 months ago

Bot detected the issue body's language is not English, translate it automatically. 👯👭🏻🧑‍🤝‍🧑👫🧑🏿‍🤝‍🧑🏻👩🏾‍🤝‍👨🏿👬🏿


The lobehub deployed with docker cannot be synchronized on the LAN. I deployed lobechat on one host using docker, and then accessed the IP through the intranet through other devices. It turned out that the synchronization function could be enabled on the host where lobechat was deployed, but the synchronization function on other hosts could not be enabled.

The specific performance is as follows: Although the "Turn on synchronization" button of cloud synchronization is turned on, it always shows that synchronization is not turned on.

EnergeticMrMask commented 8 months ago

使用docker在vps上部署,在windows和安卓手机上使用,访问同一个端口。两台设备不管在什么条件下都无法同步。配置完成打开同步开关选项后没有任何变化,依然显示同步未开启

lobehubbot commented 8 months ago

Bot detected the issue body's language is not English, translate it automatically. 👯👭🏻🧑‍🤝‍🧑👫🧑🏿‍🤝‍🧑🏻👩🏾‍🤝‍👨🏿👬🏿


Use docker to deploy on vps, use it on windows and Android phones, and access the same port. The two devices cannot be synchronized regardless of the conditions. After the configuration is completed and the synchronization switch option is turned on, there is no change, and it still shows that synchronization is not turned on.

lobehubbot commented 8 months ago

Bot detected the issue body's language is not English, translate it automatically. 👯👭🏻🧑‍🤝‍🧑👫🧑🏿‍🤝‍🧑🏻👩🏾‍🤝‍👨🏿👬🏿


This is the holiday automatic reply email from QQ mailbox. Hello, I am currently on vacation and cannot reply to your email personally. I will get back to you as soon as possible after the holiday.

ImAmelie commented 8 months ago

2 个情景, 显示 已同步,但是实际上只有 1 个场景同步成功。

场景A(同步成功)

机器1:win11 Chrome

机器2:安卓 Chrome

在同一局域网

场景B(同步失败)

机器1:win10 Edge

机器2:安卓 Chrome

不在同一局域网

lobehubbot commented 8 months ago

Bot detected the issue body's language is not English, translate it automatically. 👯👭🏻🧑‍🤝‍🧑👫🧑🏿‍🤝‍🧑🏻👩🏾‍🤝‍👨🏿👬🏿


There are 2 scenes, both show Synced, but even on only 1 scene is synced.

Scenario A (synchronization successful)

Machine 1: win11 Chrome

Machine 2: Android Chrome

in the same LAN

Scenario B (synchronization failure)

Machine 1: win10 Edge

Machine 2: Install Chrome

Not in the same LAN

chenzhq commented 8 months ago

Mac 和 IOS 无法同步 Mac + IOS + Android + Windows 可以同步 都是同一局域网


准确说是有同步状态,但看不到其它设备

GentlemanHu commented 8 months ago

https://github.com/vrtmrz/obsidian-livesync 看到Obsidian这个实时同步插件,看起来不错,能否借鉴一下

lobehubbot commented 8 months ago

Bot detected the issue body's language is not English, translate it automatically. 👯👭🏻🧑‍🤝‍🧑👫🧑🏿‍🤝‍🧑🏻👩🏾‍🤝‍👨🏿👬🏿


https://github.com/vrtmrz/obsidian-livesync I saw the real-time synchronization plug-in Obsidian. It looks good. Can you learn from it?

arvinxx commented 8 months ago

@GentlemanHu 看了下不会采用,它需要用户手动处理冲突,体验很不好的。我们后续的方案可以做到完全无冲突

lobehubbot commented 8 months ago

Bot detected the issue body's language is not English, translate it automatically. 👯👭🏻🧑‍🤝‍🧑👫🧑🏿‍🤝‍🧑🏻👩🏾‍🤝‍👨🏿👬🏿


@GentlemanHu After looking at it, I won’t adopt it. It requires users to manually handle conflicts, and the experience is very bad. Our subsequent plans can be completely conflict-free

sherlcok314159 commented 7 months ago

同步一直没成功过,换了好几个版本也没成功过 (mac-win firefox),内网,外网都不行。

同时,看起来还会向 wss://y-webrtc-signaling.lobehub.com/ 发送连接,我的数据是安全的吗?

另外,我认为 webrtc 是个糟糕的选择,理由如下:

为什么不把数据放到本地呢?借助 docker volumes 或许你根本不需要多写什么逻辑,多端根本不需要同步,而且十分稳定,我觉得你花时间重构这部分代码比你折腾 rtc 更有效率。当然,还是尊重作者的个人倾向,很赞的工具!

以上

lobehubbot commented 7 months ago

Bot detected the issue body's language is not English, translate it automatically. 👯👭🏻🧑‍🤝‍🧑👫🧑🏿‍🤝‍🧑🏻👩🏾‍🤝‍👨🏿👬🏿


The synchronization has never been successful, even after changing several versions (mac-win firefox), neither on the internal network nor on the external network.

Also, it looks like a connection is being sent to wss://y-webrtc-signaling.lobehub.com/, is my data safe?

Also, I think webrtc is a bad choice for the following reasons:

Why not put the data locally? With docker volumes, you may not need to write any more logic at all. The multiple terminals do not need to be synchronized at all, and they are very stable. I think it is more efficient for you to spend time refactoring this part of the code than to toss around rtc. Of course, I still respect the author’s personal preferences. It’s a great tool!

above

coulsontl commented 7 months ago

找到问题了,之前为了防止DNS泄露,开了Chrome的 WebRTC Network Limiter 插件,把这个插件关了就好了;希望作者能出个离线同步的功能。