braid-http 0.3.20 → 0.3.22
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/{readme.md → README.md} +4 -4
- package/braid-http-server.js +1 -1
- package/package.json +2 -2
package/{readme.md → README.md}
RENAMED
|
@@ -103,15 +103,15 @@ async function connect () {
|
|
|
103
103
|
async function connect () {
|
|
104
104
|
try {
|
|
105
105
|
var subscription_iterator = fetch('/chat', {subscribe: true}).subscription
|
|
106
|
-
for await (var
|
|
106
|
+
for await (var update of subscription_iterator) {
|
|
107
107
|
// Updates might come in the form of patches:
|
|
108
|
-
if (
|
|
109
|
-
chat = apply_patches(
|
|
108
|
+
if (update.patches)
|
|
109
|
+
chat = apply_patches(update.patches, chat)
|
|
110
110
|
|
|
111
111
|
// Or complete snapshots:
|
|
112
112
|
else
|
|
113
113
|
// Beware the server doesn't send these yet.
|
|
114
|
-
chat = JSON.parse(
|
|
114
|
+
chat = JSON.parse(update.body)
|
|
115
115
|
|
|
116
116
|
render_stuff()
|
|
117
117
|
}
|
package/braid-http-server.js
CHANGED
|
@@ -66,7 +66,7 @@ ${patch.content}`
|
|
|
66
66
|
// Deprecated method for legacy support
|
|
67
67
|
function parse_patches (req, cb) {
|
|
68
68
|
parse_update(req, update => {
|
|
69
|
-
if (update.body)
|
|
69
|
+
if (typeof update.body === 'string')
|
|
70
70
|
// Return body as an "everything" patch
|
|
71
71
|
cb([{unit: 'everything', range: '', content: update.body}])
|
|
72
72
|
else
|
package/package.json
CHANGED
|
@@ -1,12 +1,12 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "braid-http",
|
|
3
|
-
"version": "0.3.
|
|
3
|
+
"version": "0.3.22",
|
|
4
4
|
"description": "An implementation of Braid-HTTP for Node.js and Browsers",
|
|
5
5
|
"scripts": {
|
|
6
6
|
"test": "node test/server.js"
|
|
7
7
|
},
|
|
8
8
|
"author": "Braid Working Group",
|
|
9
|
-
"repository": "braid-org/
|
|
9
|
+
"repository": "braid-org/braid-http",
|
|
10
10
|
"homepage": "https://braid.org",
|
|
11
11
|
"files": [
|
|
12
12
|
"braid-http-client.js",
|