Commit f5c87f9c authored by Eugene Shen's avatar Eugene Shen

Use replicate storage and request smaller bundles

Store all chats as Text Posts using ERP5 in a replicate storage.
Synchronize divergent chats through a three-step process:
1. send doubler (request a request from the host)
   receive request (get dict of host's last-seen messages)
2. send archive (give all new messages to the host)
   receive doubler (get after host is fully updated)
3. send request (give dict of your last-seen messages)
   receive archive (get all new messages from all peers)

This means that Space Chat now synchronizes correctly even when
peers disconnect from each other, and all chat messages will
eventually be stored on ERP5 as soon as one peer reconnects.
parent bb0d31e5
......@@ -89,7 +89,7 @@
</item>
<item>
<key> <string>id</string> </key>
<value> <string>adapter.js</string> </value>
<value> <string>adapter_js</string> </value>
</item>
<item>
<key> <string>language</string> </key>
......
......@@ -89,7 +89,7 @@
</item>
<item>
<key> <string>id</string> </key>
<value> <string>fast_priority_queue.js</string> </value>
<value> <string>fast_priority_queue_js</string> </value>
</item>
<item>
<key> <string>language</string> </key>
......
......@@ -90,7 +90,7 @@
</item>
<item>
<key> <string>id</string> </key>
<value> <string>gadget_erp5_chat.css</string> </value>
<value> <string>gadget_erp5_chat_css</string> </value>
</item>
<item>
<key> <string>language</string> </key>
......
......@@ -93,7 +93,7 @@
</item>
<item>
<key> <string>id</string> </key>
<value> <string>gadget_erp5_chat.html</string> </value>
<value> <string>gadget_erp5_chat_html</string> </value>
</item>
<item>
<key> <string>language</string> </key>
......
......@@ -15,8 +15,28 @@
})
.push(function (my_gadget) {
return my_gadget.createJio({
type: "indexeddb",
database: "officejs_chat"
type: "replicate",
query: {
query: 'portal_type: "Text Post"',
limit: [0, 1000000000]
},
local_sub_storage: {
type: "query",
sub_storage: {
type: "uuid",
sub_storage: {
type: "indexeddb",
database: "officejs_chat"
}
}
},
remote_sub_storage: {
type: "erp5",
url: "https://softinst75770.host.vifib.net/erp5/web_site_module/web_chat/hateoas/",
default_view_reference: "view"
},
conflict_handling: 2,
use_remote_post: true
});
});
})
......
......@@ -68,6 +68,7 @@
<value>
<tuple>
<string>classification/collaborative/team</string>
<string>contributor/person_module/1</string>
</tuple>
</value>
</item>
......@@ -89,7 +90,7 @@
</item>
<item>
<key> <string>id</string> </key>
<value> <string>gadget_erp5_chat.js</string> </value>
<value> <string>gadget_erp5_chat_js</string> </value>
</item>
<item>
<key> <string>language</string> </key>
......
......@@ -94,7 +94,7 @@
</item>
<item>
<key> <string>id</string> </key>
<value> <string>gadget_erp5_chat_login.html</string> </value>
<value> <string>gadget_erp5_chat_login_html</string> </value>
</item>
<item>
<key> <string>language</string> </key>
......
......@@ -90,7 +90,7 @@
</item>
<item>
<key> <string>id</string> </key>
<value> <string>gadget_erp5_chat_login.js</string> </value>
<value> <string>gadget_erp5_chat_login_js</string> </value>
</item>
<item>
<key> <string>language</string> </key>
......
......@@ -12,6 +12,8 @@
</head>
<body>
<h3>Chat List</h3>
<p class="error">
</p>
<div class="chat">
</div>
<form class="send-form">
......
......@@ -94,7 +94,7 @@
</item>
<item>
<key> <string>id</string> </key>
<value> <string>gadget_erp5_chat_panel.html</string> </value>
<value> <string>gadget_erp5_chat_panel_html</string> </value>
</item>
<item>
<key> <string>language</string> </key>
......
......@@ -90,7 +90,7 @@
</item>
<item>
<key> <string>id</string> </key>
<value> <string>gadget_erp5_chat_panel.js</string> </value>
<value> <string>gadget_erp5_chat_panel_js</string> </value>
</item>
<item>
<key> <string>language</string> </key>
......
......@@ -11,13 +11,12 @@
<script src="gadget_erp5_chat_webrtc.js"></script>
</head>
<body>
<p class="timeout-alert">
</p>
<form class="dropbox-form">
<label>Automatically connect via Dropbox</label>
<br />
<a class="dropbox-login">
Log in to Dropbox!
</a>
<br />
<input type="submit" value="Authenticate!" />
</form>
......@@ -61,5 +60,9 @@
<br />
<input type="submit" value="Paste it!" />
</form>
<div data-gadget-url="gadget_erp5_chat_panel.html"
data-gadget-scope="chat_gadget"
data-gadget-sandbox="public" class="chat-panel"></div>
</body>
</html>
\ No newline at end of file
......@@ -94,7 +94,7 @@
</item>
<item>
<key> <string>id</string> </key>
<value> <string>gadget_erp5_chat_webrtc.html</string> </value>
<value> <string>gadget_erp5_chat_webrtc_html</string> </value>
</item>
<item>
<key> <string>language</string> </key>
......
......@@ -90,7 +90,7 @@
</item>
<item>
<key> <string>id</string> </key>
<value> <string>gadget_erp5_chat_webrtc.js</string> </value>
<value> <string>gadget_erp5_chat_webrtc_js</string> </value>
</item>
<item>
<key> <string>language</string> </key>
......
web_page_module/adapter.js
web_page_module/fast_priority_queue.js
web_page_module/adapter_js
web_page_module/fast_priority_queue_js
web_page_module/gadget_erp5_chat*
web_site_module/web_chat/**
\ No newline at end of file
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment