はじまりの大地
このコミットが含まれているのは:
@@ -0,0 +1,36 @@
|
||||
const WebSocketServer = require('ws').WebSocketServer
|
||||
|
||||
async function register ({
|
||||
registerWebSocketRoute
|
||||
}) {
|
||||
const wss = new WebSocketServer({ noServer: true })
|
||||
|
||||
wss.on('connection', function connection(ws) {
|
||||
ws.on('message', function message(data) {
|
||||
if (data.toString() === 'ping') {
|
||||
ws.send('pong')
|
||||
}
|
||||
})
|
||||
})
|
||||
|
||||
registerWebSocketRoute({
|
||||
route: '/toto',
|
||||
|
||||
handler: (request, socket, head) => {
|
||||
wss.handleUpgrade(request, socket, head, ws => {
|
||||
wss.emit('connection', ws, request)
|
||||
})
|
||||
}
|
||||
})
|
||||
}
|
||||
|
||||
async function unregister () {
|
||||
return
|
||||
}
|
||||
|
||||
module.exports = {
|
||||
register,
|
||||
unregister
|
||||
}
|
||||
|
||||
// ###########################################################################
|
||||
@@ -0,0 +1,20 @@
|
||||
{
|
||||
"name": "peertube-plugin-test-websocket",
|
||||
"version": "0.0.1",
|
||||
"description": "Plugin test websocket",
|
||||
"engine": {
|
||||
"peertube": ">=1.3.0"
|
||||
},
|
||||
"keywords": [
|
||||
"peertube",
|
||||
"plugin"
|
||||
],
|
||||
"homepage": "https://github.com/Chocobozzz/PeerTube",
|
||||
"author": "Chocobozzz",
|
||||
"bugs": "https://github.com/Chocobozzz/PeerTube/issues",
|
||||
"library": "./main.js",
|
||||
"staticDirs": {},
|
||||
"css": [],
|
||||
"clientScripts": [],
|
||||
"translations": {}
|
||||
}
|
||||
新しい課題から参照
ユーザをブロックする