Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Uploaded images are not shared/stored #56

Closed
Tracked by #47
juliushaertl opened this issue Jul 4, 2024 · 6 comments · Fixed by #140
Closed
Tracked by #47

Uploaded images are not shared/stored #56

juliushaertl opened this issue Jul 4, 2024 · 6 comments · Fixed by #140
Assignees
Labels
bug Something isn't working
Milestone

Comments

@juliushaertl
Copy link
Member

juliushaertl commented Jul 4, 2024

We need to figure out:

  • how images are referenced or stored in the excalidraw format
  • how we can persist them
@juliushaertl juliushaertl mentioned this issue Jul 4, 2024
26 tasks
@juliushaertl juliushaertl changed the title 🔴 Image seems to be not distributed accross sessions Uploaded images are not shared/stored Jul 4, 2024
@juliushaertl juliushaertl added the bug Something isn't working label Jul 4, 2024
@juliushaertl juliushaertl added this to the 1.0 milestone Jul 4, 2024
@juliushaertl
Copy link
Member Author

Files are identified by some hash value in excalidraw as a reference and need to be stored/managed separately. When inserting an image we can observe the file data being available though the onChange callback

Screenshot 2024-08-29 at 08 35 16

https://github.com/excalidraw/excalidraw/blob/master/excalidraw-app/App.tsx#L462
https://github.com/excalidraw/excalidraw/blob/576bc0dbe52c705b5251a3599962d5d53749994d/excalidraw-app/collab/Portal.tsx#L179

We need to think about:

  • Where do we store the images, can we use the node backend to also keep images and
    • let it write them to the .excalidraw file
    • or should we store them separately like text in a .attachments folder?
  • Writing into the .excalidraw file would be nice (also supported by the schema) as it then would not have dependencies of external structures when copying or moving the file
  • We need to be careful on how we handle those so that it is not included in every sync over the websocket, maybe also not being hold in memory on the node backend
  • Maybe we can still distribute the files over the websocket

@hweihwang @grnd-alt Would be curious about your input here. Any thoughts around that?

@grnd-alt
Copy link
Member

I would certainly try implementing it with writing to the .excalidraw file. There's a max size to websocket messages but that can be increased (though there will always be a limit). I think websocket distribution of images should be possible, we might have to improve our update mechanism to send fewer elements in updates which are not needed, but we should have a look at that in the future anyway.

@hweihwang
Copy link
Contributor

Yes agreed, general issue as the board data grows, several concerns arise:

  • Websocket bandwidth
  • Frontend performance reapplying the big chunk of data (Not sure if currently excalidraw api caring about this well)
  • Node/Redis memory
  • Networking when sending big JSON between Node & PHP
  • I/O when reading/writing those JSON to file

@hweihwang
Copy link
Contributor

@juliushaertl
Copy link
Member Author

My suggestion would be to split the actual image data transfer from the regular sync messages that distribute the elements on the board.

The node backend could extract the file data from the .excalidraw file and the frontend would request it separately once coming across an image node with the reference hash. Then we could send the individual images back in one websocket message per image.

Otherwise we could also consider a plain http endpoint for fetching the images, but that would require some extra handling for authentication compared to the websocket

@juliushaertl
Copy link
Member Author

I'll have a look into this

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
Archived in project
Development

Successfully merging a pull request may close this issue.

3 participants