@hocuspocus/server
Advanced tools
Comparing version 1.0.0-alpha.70 to 1.0.0-alpha.73
@@ -1581,3 +1581,3 @@ import WebSocket from 'ws'; | ||
var description = "plug & play collaboration backend"; | ||
var version = "1.0.0-alpha.69"; | ||
var version = "1.0.0-alpha.72"; | ||
var homepage = "https://hocuspocus.dev"; | ||
@@ -1809,10 +1809,9 @@ var keywords = [ | ||
// If no hook interrupts, create a document and connection | ||
this.createDocument(documentName, request, socketId, connection, context).then(document => { | ||
this.createConnection(incoming, request, document, socketId, connection.readOnly, context); | ||
// Remove the queue listener | ||
incoming.off('message', listener); | ||
// Work through queued messages | ||
incomingMessageQueue.forEach(input => { | ||
incoming.emit('message', input); | ||
}); | ||
const document = await this.createDocument(documentName, request, socketId, connection, context); | ||
this.createConnection(incoming, request, document, socketId, connection.readOnly, context); | ||
// Remove the queue listener | ||
incoming.off('message', listener); | ||
// Work through queued messages | ||
incomingMessageQueue.forEach(input => { | ||
incoming.emit('message', input); | ||
}); | ||
@@ -1967,2 +1966,8 @@ }; | ||
}); | ||
// If the websocket has already disconnected (wow, that was fast) – then | ||
// immediately call close to cleanup the connection and doc in memory. | ||
if (connection.readyState === WsReadyStates.Closing | ||
|| connection.readyState === WsReadyStates.Closed) { | ||
instance.close(); | ||
} | ||
return instance; | ||
@@ -1969,0 +1974,0 @@ } |
{ | ||
"name": "@hocuspocus/server", | ||
"description": "plug & play collaboration backend", | ||
"version": "1.0.0-alpha.70", | ||
"version": "1.0.0-alpha.73", | ||
"homepage": "https://hocuspocus.dev", | ||
@@ -35,3 +35,3 @@ "keywords": [ | ||
}, | ||
"gitHead": "981e76320fd0bac82cbbdb027ec3c91a4c6cfce4" | ||
"gitHead": "555bb01c2c40f80183bf8a123a533169c5fdb29c" | ||
} |
@@ -122,3 +122,2 @@ import AsyncLock from 'async-lock' | ||
done() | ||
}) | ||
@@ -125,0 +124,0 @@ } |
@@ -7,3 +7,5 @@ import * as decoding from 'lib0/decoding' | ||
import { v4 as uuid } from 'uuid' | ||
import { MessageType, Configuration, ConnectionConfig } from './types' | ||
import { | ||
MessageType, Configuration, ConnectionConfig, WsReadyStates, | ||
} from './types' | ||
import Document from './Document' | ||
@@ -217,11 +219,11 @@ import Connection from './Connection' | ||
// If no hook interrupts, create a document and connection | ||
this.createDocument(documentName, request, socketId, connection, context).then(document => { | ||
this.createConnection(incoming, request, document, socketId, connection.readOnly, context) | ||
const document = await this.createDocument(documentName, request, socketId, connection, context) | ||
this.createConnection(incoming, request, document, socketId, connection.readOnly, context) | ||
// Remove the queue listener | ||
incoming.off('message', listener) | ||
// Work through queued messages | ||
incomingMessageQueue.forEach(input => { | ||
incoming.emit('message', input) | ||
}) | ||
// Remove the queue listener | ||
incoming.off('message', listener) | ||
// Work through queued messages | ||
incomingMessageQueue.forEach(input => { | ||
incoming.emit('message', input) | ||
}) | ||
@@ -401,2 +403,11 @@ } | ||
// If the websocket has already disconnected (wow, that was fast) – then | ||
// immediately call close to cleanup the connection and doc in memory. | ||
if ( | ||
connection.readyState === WsReadyStates.Closing | ||
|| connection.readyState === WsReadyStates.Closed | ||
) { | ||
instance.close() | ||
} | ||
return instance | ||
@@ -403,0 +414,0 @@ } |
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
6142
514256
67