working servo and photoresistor with websocket

This commit is contained in:
2024-03-05 00:26:06 +07:00
parent f897b3bf50
commit 80bedd3cb3
11 changed files with 93 additions and 31 deletions

19
test/websocket/common.ts Normal file
View File

@@ -0,0 +1,19 @@
import http from 'node:http';
import express from 'express';
import { Server } from "socket.io";
const app = express();
const server = http.createServer(app);
const io = new Server(server);
io.on("connection", (socket) => {
console.log("Connected");
socket.on("message", (message) => {
console.log(message);
})
})
server.listen(3001, "localhost", () => {
console.log("Common server is running");
})