socket.io

This commit is contained in:
Ben
2020-06-16 03:25:46 +01:00
parent db4f403e16
commit e71de57d86
4 changed files with 55 additions and 3 deletions

View File

@@ -13,3 +13,23 @@
[16-06-20 02:52:49] HTTP server listening on port 8080
[16-06-20 02:52:49] WebSocket server listening on 8080
[16-06-20 02:52:51] New socket connection from ip: ::1, unique id: 7W0rQzo24-UqCalpAAAA
[16-06-20 03:11:04] HTTP server listening on port 8080
[16-06-20 03:11:04] WebSocket server listening on 8080
[16-06-20 03:11:05] New socket connection from ip: ::1, unique id: Q2m7dtTGe6lNQxo5AAAA
[16-06-20 03:11:12] New socket connection from ip: ::1, unique id: qJ1bfjS0_61x7G4-AAAB
[16-06-20 03:11:28] HTTP server listening on port 8080
[16-06-20 03:11:28] WebSocket server listening on 8080
[16-06-20 03:11:28] New socket connection from ip: ::1, unique id: QNTLHDsXxz7TX4IRAAAA
[16-06-20 03:11:30] New socket connection from ip: ::1, unique id: WpmATpvyOYtWfHp_AAAB
[16-06-20 03:12:50] New socket connection from ip: ::1, unique id: 7HcseLMEU0cMIHLtAAAC
[16-06-20 03:19:16] HTTP server listening on port 8080
[16-06-20 03:19:16] WebSocket server listening on 8080
[16-06-20 03:19:16] New socket connection from ip: ::1, unique id: jru-gz5sOMdHMYicAAAA
[16-06-20 03:19:18] New socket connection from ip: ::1, unique id: lCBoInIW8DjhXPaLAAAB
[16-06-20 03:24:30] HTTP server listening on port 8080
[16-06-20 03:24:30] WebSocket server listening on 8080
[16-06-20 03:24:31] New socket connection from ip: ::1, unique id: X-G4yZ0D-5ChdSEFAAAA
[16-06-20 03:24:43] HTTP server listening on port 8080
[16-06-20 03:24:43] WebSocket server listening on 8080
[16-06-20 03:24:43] New socket connection from ip: ::ffff:127.0.0.1, unique id: EDr3u3IDv2e1cVwQAAAA
[16-06-20 03:24:44] New socket connection from ip: ::1, unique id: 7qeD4lAnehuv25SFAAAB

View File

@@ -1,5 +1,20 @@
let socket = io();
let Socket = io();
(() => {
(() =>
{
console.log('Starting up');
})();
const VideoInput = document.getElementById("VideosToRecord");
VideoInput.oninput = () =>
{
const ToSend = {
// TODO: add toggle
ExpectPreview: true,
Content: VideoInput.value.split('\n')
};
Socket.emit('VideoListUpdate', ToSend);
};
Socket.on('VideoListResolution', (req) => console.log(req));

View File

@@ -25,9 +25,24 @@ module.exports.Listen = async () =>
io.on('connection', async (socket) => {
Logger.Log(`New socket connection from ip: ${socket.handshake.address}, unique id: ${socket.id}`);
SocketHandler(socket);
});
}
function SocketHandler(socket)
{
socket.on('VideoListUpdate', (req) => VideoListUpdate(socket, req) );
}
async function VideoListUpdate(socket, req)
{
socket.emit('VideoListResolution', req.Content);
}
module.exports.App = app;
module.exports.Http = http;
module.exports.Io = io;

View File

@@ -1,5 +1,7 @@
const YTDL = require('ytdl-core');
// TODO: does the video resolver need a queue?
module.exports.GetVideoInfoArr = async (arr) =>
{