Skip to content

Commit

Permalink
test socket
Browse files Browse the repository at this point in the history
  • Loading branch information
Giona Righini committed Aug 26, 2024
1 parent 6f665f1 commit af883b5
Showing 1 changed file with 3 additions and 11 deletions.
14 changes: 3 additions & 11 deletions tests/socket.js
Original file line number Diff line number Diff line change
@@ -1,19 +1,11 @@
const http = require("http");
const { Server } = require("socket.io");
const server = http.createServer();
const io = new Server(server);
const io = require("socket.io-client");

const ioc = require("socket.io-client");

server.listen(3000, () => {});
setTimeout(() => io.emit("test", 12), 2000);

const socket = ioc("http://localhost:3000");
const socket = io("http://10.8.0.5:3000");

socket.on("connect", () => {
console.log("connected!");
});

socket.on("test", (msg) => {
socket.on("data", (msg) => {
console.log("Received:", msg);
});

0 comments on commit af883b5

Please sign in to comment.