Comments (2)
Hi! The upgrade event was indeed missing from the documentation, this should be fixed now (socketio/engine.io@535b068).
how I should add some verification information in the upgrade request header, and reject the upgrade if the verification information is illegal.
You can manually handle the upgrade
event of the Node.js HTTP server:
import { createServer } from "http";
import { Server } from "socket.io";
const httpServer = createServer();
const io = new Server(httpServer);
httpServer.removeAllListeners("upgrade");
httpServer.on("upgrade", (req, socket, head) => {
// do some verification...
// then
io.engine.handleUpgrade(req, socket, head);
});
httpServer.listen(3000);
Reference: https://nodejs.org/api/http.html#event-upgrade_1
from socket.io-website.
Thank you so much!
from socket.io-website.
Related Issues (20)
- add note about `withCredentials` default value in Migrating from 2.x to 3.0 HOT 2
- Apply Socket Io in hacktobberfest 2022 HOT 2
- Issue on links on 'Options' section on client-initialization.md HOT 1
- Engine.IO: Typo in heartbeat documentation HOT 1
- Express Sesssion Middleware with Typescript Build Error
- [docs] adapter-redis-streams client HOT 1
- [docs] Improve Socket.io Testing documentation with integration test HOT 1
- Dark theme not applied by default based on the user OS/Browser preference HOT 1
- [Bug]: padding in announcementBar HOT 3
- Outdated MongoDB Connection Example in Documentation HOT 1
- Sponsers logo not visible in dark mode HOT 2
- Update: Hover/Transition Over Get started and Documentation Buttons!! HOT 4
- Fix: Incorrect path resolution in ES module example HOT 1
- Where would the translation files for "how to" be located?
- hyperlink points to French Wikipedia page HOT 1
- Server Delivery tutorial is missing things HOT 2
- The videos don't seem to play in the tutorials HOT 2
- WebTransport example: WebTransport server throws error HOT 1
- Cloudflare example HOT 2
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from socket.io-website.