socketio / socketio/socket.io

`socket.io-client` on the browser

Open
#5,383 1 comment 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

enhancement
Dominant language
TypeScript
Stars
63.2k
Forks
10.3k
Avg merge
11d 20h
Merged PRs (30d)
2

Description

Describe the bug
I want to be able to import the client version without having to use a bundler / using the serveClient option on the server. Can you just provide an ES2020 module that I can just directly import?

This is when I use the npm package instead of a http import (so I get typescript support).

Expected behavior

// client.ts (bundled for browser)
import { io } from 'socket.io-client/browser';
// ...

What I am currently doing
copying the esm output to a local directory

// client.ts (bundled for browser)
// @ts-types="npm:socket.io-client"
import { io } from './socket.io.esm.min.js';
deno bundle client.ts -o client.js

Platform:

  • Runtime: Deno 2.4.5
  • OS: Windows 10

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start with the client.ts import example and the existing socket.io.esm.min.js output, then inspect how the npm package exposes browser entry points. Done means a TypeScript client can import socket.io-client/browser from the npm package and bundle successfully with the shown Deno command.

Written by the indexing model from the issue text.

Assessment

Tech stack
deno, typescript
Domain
frontend, web-dev
Issue type
Feature
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.