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

Does this project also support the socket.io client?

Open fucksophie opened this issue 2 years ago • 8 comments

Recently, I was trying to use import { io } from "https://cdn.socket.io/4.6.1/socket.io.esm.min.js"; in a deno project, but it didn't seem to work. Nothing was emitted. 🤔 Maybe this project implements a fixed version of the socket.io client? I couldn't find it in the repo, but I hope it's somewhere in here. Thanks much!

fucksophie avatar Feb 24 '23 17:02 fucksophie

Hi! No, the JavaScript client is not compatible with Deno, but if there is enough interest we could totally implement it.

darrachequesne avatar Feb 25 '23 21:02 darrachequesne

So, how connect from client with server?

sonickseven avatar Apr 10 '23 16:04 sonickseven

I'm worried about that too...

nakasyou avatar Jun 09 '23 11:06 nakasyou

people, it can be done with deno using the socket.io client

This code works:

import { io } from "https://cdn.socket.io/4.6.1/socket.io.esm.min.js";

const socket = io("http://localhost:8080/", {
  transports: ["websocket"],
});

socket.on("connect", () => {
  console.log(socket.id); // x8WIv7-mJelg7on_ALbx
});

RomanFama592 avatar Dec 25 '23 19:12 RomanFama592