blocksuite icon indicating copy to clipboard operation
blocksuite copied to clipboard

Blob sharing support in new playground

Open doouding opened this issue 2 years ago • 7 comments

The new playground does not support images or binary file sharing in collaboration. Paste an image on the playground will not be visible to other peers.

doouding avatar Aug 28 '23 07:08 doouding

I am facing the same problem. Although not efficient, I considered converting the blob to base64 and treating it as a key, but that was impossible because the BlobEngine set appears to return a key, but it is not used at all. https://github.com/toeverything/blocksuite/pull/6937

Specifically, this page does not support image transfer.

@Flrande Do you have any ideas?

satoren avatar Aug 08 '24 09:08 satoren

I am facing the same problem. Although not efficient, I considered converting the blob to base64 and treating it as a key, but that was impossible because the BlobEngine set appears to return a key, but it is not used at all. #6937

Specifically, this page does not support image transfer.

@Flrande Do you have any ideas?

BlockSuite Playground does not support Blob sharing for collaboration, as it is only meant for people to try out and debug. If you need to support the sharing of Blob resources, you'll need to implement your own BlobSource.

Flrande avatar Aug 08 '24 09:08 Flrande

Thanks for the reply.

you'll need to implement your own BlobSource.

I understand that. Even if we implement that, it seems like the only way to implement it is to require an external storage server, is that correct?

=== update === If there is no other way now, I think I can support it without an external storage server at the expense of 1.3x the transfer volume by using the key returned by BlobSource and including the data in Base64 in the key, what do you think about that idea?

satoren avatar Aug 08 '24 10:08 satoren

The following changes. https://github.com/satoren/blocksuite/commit/322d9b62c0a200bb4c0a51815de51bb4e292b1a8

satoren avatar Aug 09 '24 01:08 satoren

I suggest having a server for storing Blob data, as transmitting it solely through Base64 may impose a significant burden on collaborative operations.

Flrande avatar Aug 09 '24 07:08 Flrande

When I checked to see if the load was that high, I confirmed that the playground requires an additional 4 times the network bandwidth and CPU processing because it sends the yjs payload in a json array representation. This is certainly fatal.

satoren avatar Aug 09 '24 07:08 satoren

Yes, the implementation of Playground is very simple. You can refer to the code of AFFiNE for actual production.

https://github.com/toeverything/AFFiNE/tree/canary/packages/common/infra/src/sync/doc

Flrande avatar Aug 09 '24 07:08 Flrande