-
Notifications
You must be signed in to change notification settings - Fork 54
Open
Labels
Description
This will add real time data changes in we.js apps with good performance
Use some Share.js modules for this feature.
Check ACL (how to do this in an fast way)?
Use websockets or pooling or both?
Cache fields in memory?
Steps:
Change from client to server
- [client] Generate the change actions in client for related model attr
- [client] post to host
- [server] Check if model exists
- [server] Apply the changes in model attr
- [server] Save the changes in ot_model table
- [server] respond with new changeId and 200 (success)
- [client] save the changeId
Get changes from server (pooling)
- do the pooling check with last changeId
- if receive updates then apply in current text
Get changes from server (websockets)
- watch for changes from server
- on receive change check changeId and if is new apply update in text
Tables:
ot_model table:
this table will store permanently all changes in order, chages are an object with { fieldName: { ot-changes } }
id: INTEGER auto increment
modelName: STRING(20)
modelId: INTEGER
field: STRING(20)
changerId: INTEGER
change: OT changes JSON
changeNumber: INTEGER
Links
- About operational transform: https://en.wikipedia.org/wiki/Operational_transformation
- Other node.js OT teth: http://etherpad.org/