简体   繁体   中英

viewing LIVE drawing on CANVAS for multiple users

I am creating interactive network diagram on canvas where users can drag and drop, etc. Things are drawn on the canvas with javascript. And on submit, data on the canvas will be sent via POST to php and mysql

What's the strategy to allow other users to see LIVE what I've on my canvas as I modifying them LIVE? I don't know if it's a good idea to use AJAX because then you would be constantly messing with the DB even before you finalize it.

I'm not asking for specific code, just big picture STRATEGY, potential LIBRARY to use, DIRECTION.

In order to do this live you have about 3 options.

Comet http://en.wikipedia.org/wiki/Comet_%28programming%29

Ajax Polling http://en.wikipedia.org/wiki/Ajax_%28programming%29 (Make your ajax call every minute, seconds or whatever, there are obvious downsides to do it more quickly.)

Websockets (very experimental but now working in FF5 again) http://en.wikipedia.org/wiki/Websockets

Also you want to seriously think about storing the data that's going to be accessed in memory instead of a db so that every time a request is made or pushed or whatever method you are going to use, it doesn't hit the database everytime. Use a database for permanent storage only, not for data that will be accessed every second.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM