diff --git a/peertube-plugin-hello-world/main.js b/peertube-plugin-hello-world/main.js index 3b9e429..893deae 100644 --- a/peertube-plugin-hello-world/main.js +++ b/peertube-plugin-hello-world/main.js @@ -178,15 +178,18 @@ async function register ({ }, 1000) }) - registerWebSocketRoute({ - route: '/toto', + // Backward compatibility + if (registerWebSocketRoute) { + registerWebSocketRoute({ + route: '/toto', - handler: (request, socket, head) => { - wss.handleUpgrade(request, socket, head, ws => { - wss.emit('connection', ws, request) - }) - } - }) + handler: (request, socket, head) => { + wss.handleUpgrade(request, socket, head, ws => { + wss.emit('connection', ws, request) + }) + } + }) + } } async function unregister () { diff --git a/peertube-plugin-hello-world/package-lock.json b/peertube-plugin-hello-world/package-lock.json index ca1588d..93a6ff6 100644 --- a/peertube-plugin-hello-world/package-lock.json +++ b/peertube-plugin-hello-world/package-lock.json @@ -1,12 +1,12 @@ { "name": "peertube-plugin-hello-world", - "version": "0.0.21", + "version": "0.0.22", "lockfileVersion": 2, "requires": true, "packages": { "": { "name": "peertube-plugin-hello-world", - "version": "0.0.21", + "version": "0.0.22", "dependencies": { "ws": "^8.9.0" } diff --git a/peertube-plugin-hello-world/package.json b/peertube-plugin-hello-world/package.json index 4b62a8f..39fda4c 100644 --- a/peertube-plugin-hello-world/package.json +++ b/peertube-plugin-hello-world/package.json @@ -1,6 +1,6 @@ { "name": "peertube-plugin-hello-world", - "version": "0.0.21", + "version": "0.0.22", "description": "Hello world PeerTube plugin example", "engine": { "peertube": ">=3.2.0"