Init Commit

Server
- Working init discord bot
    - Modular events and commands
    - Has access to the socket server
- Working init socket server
    - Need to work on getting access to discord bot
- Working init web server

Currently working on breaking out the init of the socket server

Client
- Working init socket client

Currently working on the discord bot to join voice channels
This commit is contained in:
Logan Cusano
2024-01-08 00:12:47 -05:00
parent 86dd058d2a
commit 4a0b1004d2
16 changed files with 2599 additions and 0 deletions

View File

@@ -0,0 +1,37 @@
import { io } from "socket.io-client";
export function initSocketConnection() {
const serverEndpoint = `http://${localNodeConfig.serverIp}:${localNodeConfig.serverPort}` || 'http://localhost:3000'; // Adjust the server endpoint
const socket = io.connect(serverEndpoint);
return socket;
}
export function initSocketListeners(socket){
socket.on('connect', () => {
console.log('Connected to the server');
logIntoServer(socket);
});
socket.on('node-join', (joinData) => {
console.log("Join requested: ", joinData)
});
socket.on('node-leave', () => {
console.log("Leave requested");
});
socket.on('disconnect', () => {
console.log('Disconnected from the server');
});
}
export function logIntoServer(socket, nodeData) {
socket.emit("node-login", nodeData);
}
export function sendNodeUpdate(socket, nodeData) {
socket.emit('node-update', nodeData);
}