socketio / socketio/socket.io

sendPacket Middleware

Open
#5,074 3 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

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

Description

Is your feature request related to a problem? Please describe.
Right now I want to implement certain authentication functionalities at the packet level to prevent the server from emitting events depending on the user. However there is no way currently of handling this at the packet emit level

Describe the solution you'd like
Something like
socket.sendPacket.use((type,data,options,next) => { next(err) //Use err to cancel sending of packet })
A clear and concise description of what you want to happen.

Describe alternatives you've considered
I've considered monkey patching to support a middleware functionality

I don't mind contributing to this feature, if it makes sense for you guys

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 by tracing Socket.IO's packet emission path and reviewing existing middleware APIs; the issue names no files or tests. Compare the proposed socket.sendPacket.use hook and next(err) cancellation behavior with current packet handling, then define the API and tests needed to show that unauthorized packets are not emitted.

Written by the indexing model from the issue text.

Assessment

Tech stack
node.js, typescript
Domain
api, backend
Issue type
Feature
Difficulty
5/5
Estimated time
Over a week
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
25/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.