question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Does not work with Vite.js and vue 3.

See original GitHub issue

Describe the bug The same code with webpack works. But Vite.js + Vue 3 is not. There is even no requests. Probably it’s not problem of socket.io-client package but something wrong with socket.io-client.

To Reproduce

Socket.IO server version: 4.2.0

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

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 Expected to see console.log messages on server and client. But it’s not working at all.

Platform:

  • OS: [e.g. Windows 10]

Issue Analytics

  • State:closed
  • Created 2 years ago
  • Reactions:2
  • Comments:6 (3 by maintainers)

github_iconTop GitHub Comments

6reactions
Taykavolcommented, Sep 3, 2021

Also, now I checked that the versons(client) 4.1.x works great (event with socket.io server 4.2.0) but something wrong with 4.2.0 client.

1reaction
darrachequesnecommented, Sep 22, 2021
Read more comments on GitHub >

github_iconTop Results From Across the Web

Getting Started - Vite
Scaffolding Your First Vite Project​​ Vite requires Node.js version 14.18+, 16+. However, some templates require a higher Node.js version to work, please upgrade ......
Read more >
Vue 3 + vite works on development but not in production
js 3 and vite. When i run on development mode, it works fine. Then i built the website using yarn build and run...
Read more >
Getting started with Vite and Vue 3 | Ninja Squad
The fun thing is that Vite is not tied to Vue: it can be used with Svelte, React and others. In fact some...
Read more >
Building a Vue3 Typescript Environment with Vite - miyauci.me
1.Add lang="ts" to the script tag in all .vue files. 2.Change main.js ...
Read more >
Introducing Vite, the Fastest Dev Server Ever - Vue.js 3 Course
Before using Vite, run a regular HTTP server with python 3: python -m http.server . This is to emphasize what Vite is not...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found