Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Minor: Event handler of 'offline' event must be added on the initial evaluation of worker script on Service Worker #1607

Open
wanfahmi11 opened this issue Feb 8, 2024 · 1 comment
Labels
to triage Waiting to be triaged by a member of the team

Comments

@wanfahmi11
Copy link

Describe the bug
Getting a warning when including socket.io client to service worker:

image

Event handler of 'offline' event must be added on the initial evaluation of worker script on Service Worker

To Reproduce

Socket.IO server version: 4.7.4

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.7.4

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
Probably can skip adding "offline" event listener for service worker, since it's already skipped it for offline, I don't see any harm skipping it for service worker.

Platform:

  • Device: [e.g. Samsung S8]
  • OS: [e.g. Android 9.2]

Additional context
I would like to contribute myself but I can't find the exact line to modify. I can find the codes in dist/socket.io.js but I'm not sure if that's the right file.

@wanfahmi11 wanfahmi11 added the to triage Waiting to be triaged by a member of the team label Feb 8, 2024
@darrachequesne
Copy link
Member

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
to triage Waiting to be triaged by a member of the team
Projects
None yet
Development

No branches or pull requests

2 participants