@hocuspocus/server
Advanced tools
Comparing version 1.0.0-alpha.74 to 1.0.0-alpha.75
@@ -1,2 +0,2 @@ | ||
import WebSocket from 'ws'; | ||
import { WebSocketServer } from 'ws'; | ||
import { createServer } from 'http'; | ||
@@ -1581,3 +1581,3 @@ import * as Y from 'yjs'; | ||
var description = "plug & play collaboration backend"; | ||
var version = "1.0.0-alpha.73"; | ||
var version = "1.0.0-alpha.74"; | ||
var homepage = "https://hocuspocus.dev"; | ||
@@ -1606,7 +1606,7 @@ var keywords = [ | ||
"@types/uuid": "^8.3.0", | ||
"@types/ws": "^7.4.0", | ||
"@types/ws": "^8.2.0", | ||
"async-lock": "^1.2.8", | ||
lib0: "^0.2.41", | ||
uuid: "^8.3.2", | ||
ws: "^7.4.3", | ||
ws: "^8.2.3", | ||
yjs: "^13.5.0" | ||
@@ -1694,3 +1694,3 @@ }; | ||
async listen() { | ||
const webSocketServer = new WebSocket.Server({ noServer: true }); | ||
const webSocketServer = new WebSocketServer({ noServer: true }); | ||
webSocketServer.on('connection', (incoming, request) => { | ||
@@ -1783,5 +1783,13 @@ this.handleConnection(incoming, request, Hocuspocus.getDocumentName(request)); | ||
async destroy() { | ||
var _a, _b; | ||
var _a, _b, _c; | ||
(_a = this.httpServer) === null || _a === void 0 ? void 0 : _a.close(); | ||
(_b = this.webSocketServer) === null || _b === void 0 ? void 0 : _b.close(); | ||
try { | ||
(_b = this.webSocketServer) === null || _b === void 0 ? void 0 : _b.close(); | ||
(_c = this.webSocketServer) === null || _c === void 0 ? void 0 : _c.clients.forEach(client => { | ||
client.terminate(); | ||
}); | ||
} | ||
catch (e) { | ||
// | ||
} | ||
this.debugger.flush(); | ||
@@ -1788,0 +1796,0 @@ await this.hooks('onDestroy', { instance: this }); |
/// <reference types="node" /> | ||
import { IncomingMessage, ServerResponse } from 'http'; | ||
import WebSocket from 'ws'; | ||
import WebSocket, { WebSocketServer } from 'ws'; | ||
import { Socket } from 'net'; | ||
@@ -15,3 +15,3 @@ import { Storage } from './Storage'; | ||
configuration: Configuration; | ||
websocketServer: WebSocket.Server; | ||
websocketServer: WebSocketServer; | ||
connections: Map<WebSocket, any>; | ||
@@ -18,0 +18,0 @@ /** |
import * as Y from 'yjs'; | ||
import { Awareness } from 'y-protocols/awareness'; | ||
import * as mutex from 'lib0/mutex'; | ||
import { CloseEvent, MessageEvent, OpenEvent } from 'ws'; | ||
import { Event, CloseEvent, MessageEvent } from 'ws'; | ||
import EventEmitter from './EventEmitter'; | ||
@@ -96,3 +96,3 @@ import { OutgoingMessage } from './OutgoingMessage'; | ||
}) => void; | ||
onOpen: (event: OpenEvent) => void; | ||
onOpen: (event: Event) => void; | ||
onConnect: () => void; | ||
@@ -145,3 +145,3 @@ onMessage: (event: MessageEvent) => void; | ||
disconnect(): void; | ||
onOpen(event: OpenEvent): void; | ||
onOpen(event: Event): void; | ||
getToken(): Promise<string | null>; | ||
@@ -148,0 +148,0 @@ webSocketConnectionEstablished(): Promise<void>; |
/// <reference types="node" /> | ||
import WebSocket from 'ws'; | ||
import WebSocket, { WebSocketServer } from 'ws'; | ||
import { IncomingMessage, Server as HTTPServer } from 'http'; | ||
@@ -17,3 +17,3 @@ import { Configuration } from './types'; | ||
httpServer?: HTTPServer; | ||
webSocketServer?: WebSocket.Server; | ||
webSocketServer?: WebSocketServer; | ||
debugger: MessageLogger; | ||
@@ -20,0 +20,0 @@ /** |
@@ -45,3 +45,3 @@ /// <reference types="node" /> | ||
*/ | ||
sendRequest(event: Events, payload: any): Promise<AxiosResponse<any>>; | ||
sendRequest(event: Events, payload: any): Promise<AxiosResponse<unknown, any>>; | ||
/** | ||
@@ -48,0 +48,0 @@ * onChange hook |
{ | ||
"name": "@hocuspocus/server", | ||
"description": "plug & play collaboration backend", | ||
"version": "1.0.0-alpha.74", | ||
"version": "1.0.0-alpha.75", | ||
"homepage": "https://hocuspocus.dev", | ||
@@ -28,10 +28,10 @@ "keywords": [ | ||
"@types/uuid": "^8.3.0", | ||
"@types/ws": "^7.4.0", | ||
"@types/ws": "^8.2.0", | ||
"async-lock": "^1.2.8", | ||
"lib0": "^0.2.41", | ||
"uuid": "^8.3.2", | ||
"ws": "^7.4.3", | ||
"ws": "^8.2.3", | ||
"yjs": "^13.5.0" | ||
}, | ||
"gitHead": "d5699cebc1fa14412a4e2cec00a842f01e90a69b" | ||
"gitHead": "49a520f1b6be37139f5c7243a484dc413640869c" | ||
} |
import * as decoding from 'lib0/decoding' | ||
import WebSocket from 'ws' | ||
import WebSocket, { WebSocketServer } from 'ws' | ||
import { createServer, IncomingMessage, Server as HTTPServer } from 'http' | ||
@@ -44,3 +44,3 @@ import { Doc, encodeStateAsUpdate, applyUpdate } from 'yjs' | ||
webSocketServer?: WebSocket.Server | ||
webSocketServer?: WebSocketServer | ||
@@ -91,3 +91,3 @@ debugger: MessageLogger = Debugger | ||
async listen(): Promise<void> { | ||
const webSocketServer = new WebSocket.Server({ noServer: true }) | ||
const webSocketServer = new WebSocketServer({ noServer: true }) | ||
webSocketServer.on('connection', (incoming: WebSocket, request: IncomingMessage) => { | ||
@@ -188,3 +188,12 @@ this.handleConnection(incoming, request, Hocuspocus.getDocumentName(request)) | ||
this.httpServer?.close() | ||
this.webSocketServer?.close() | ||
try { | ||
this.webSocketServer?.close() | ||
this.webSocketServer?.clients.forEach(client => { | ||
client.terminate() | ||
}) | ||
} catch (e) { | ||
// | ||
} | ||
this.debugger.flush() | ||
@@ -191,0 +200,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
516375
6170
+ Added@types/ws@8.5.13(transitive)
+ Addedws@8.18.0(transitive)
- Removed@types/ws@7.4.7(transitive)
- Removedws@7.5.10(transitive)
Updated@types/ws@^8.2.0
Updatedws@^8.2.3