socket.io icon indicating copy to clipboard operation
socket.io copied to clipboard

It it duplicating the self messages after refreshing the window in examples/private messages

Open MeeeeetShah opened this issue 7 months ago • 0 comments

Describe the bug It it duplicating the self messages after refreshing the window in examples/private messages

To Reproduce

Go through examples and take pull from 4th (final branch) for example/private message if we send message to self then it seems to be correct but after refreshing the window we see duplicating the self messages..

Socket.IO server version: 3.1.2

Server

import { Server } from "socket.io";

const io = new Server(3000, {});

io.on("connection", (socket) => {
  console.log(`connect ${socket.id}`);

  socket.on("disconnect", () => {
    console.log(`disconnect ${socket.id}`);
  });
});

Socket.IO client version: 4.8.1

Client

import { io } from "socket.io-client";

const socket = io("ws://localhost:3000/", {});

socket.on("connect", () => {
  console.log(`connect ${socket.id}`);
});

socket.on("disconnect", () => {
  console.log("disconnect");
});

Expected behavior It should show single message only

MeeeeetShah avatar Apr 28 '25 13:04 MeeeeetShah