Skip to content

Commit

Permalink
docs: use "connection" instead of "connect"
Browse files Browse the repository at this point in the history
"connect" and "connection" have the same meaning, but "connection" is
the preferred version.
  • Loading branch information
darrachequesne committed Aug 12, 2023
1 parent c332643 commit fd9dd74
Show file tree
Hide file tree
Showing 7 changed files with 8 additions and 8 deletions.
4 changes: 2 additions & 2 deletions CHANGELOG.md
Expand Up @@ -855,7 +855,7 @@ new Server(3000, {
const socket = io("/admin");

// server-side
io.on("connect", socket => {
io.on("connection", socket => {
// not triggered anymore
})

Expand Down Expand Up @@ -1006,7 +1006,7 @@ new Server(3000, {
const socket = io("/admin");

// server-side
io.on("connect", socket => {
io.on("connection", socket => {
// not triggered anymore
})

Expand Down
2 changes: 1 addition & 1 deletion examples/angular-todomvc/server.ts
Expand Up @@ -15,7 +15,7 @@ interface Todo {

let todos: Array<Todo> = [];

io.on("connect", (socket) => {
io.on("connection", (socket) => {
socket.emit("todos", todos);

// note: we could also create a CRUD (create/read/update/delete) service for the todo list
Expand Down
2 changes: 1 addition & 1 deletion examples/es-modules/server.js
Expand Up @@ -2,7 +2,7 @@ import { Server } from "socket.io";

const io = new Server(8080);

io.on("connect", (socket) => {
io.on("connection", (socket) => {
console.log(`connect ${socket.id}`);

socket.on("ping", (cb) => {
Expand Down
2 changes: 1 addition & 1 deletion examples/express-session-example/index.js
Expand Up @@ -67,7 +67,7 @@ io.engine.on("initial_headers", (headers, req) => {
}
});

io.on("connect", (socket) => {
io.on("connection", (socket) => {
const req = socket.request;

socket.join(req.session.id);
Expand Down
2 changes: 1 addition & 1 deletion examples/typescript/server.ts
Expand Up @@ -2,7 +2,7 @@ import { Server } from "socket.io";

const io = new Server(8080);

io.on("connect", (socket) => {
io.on("connection", (socket) => {
console.log(`connect ${socket.id}`);

socket.on("ping", (cb) => {
Expand Down
2 changes: 1 addition & 1 deletion test/namespaces.ts
Expand Up @@ -62,7 +62,7 @@ describe("namespaces", () => {
const io = new Server(0);
const clientSocket = createClient(io);

io.on("connect", (socket) => {
io.on("connection", (socket) => {
expect(socket).to.be.a(Socket);
success(done, io, clientSocket);
});
Expand Down
2 changes: 1 addition & 1 deletion test/socket.io.test-d.ts
Expand Up @@ -24,7 +24,7 @@ describe("server", () => {
expectType<DisconnectReason>(reason);
});
});
sio.on("connect", (s) => {
sio.on("connection", (s) => {
expectType<Socket<DefaultEventsMap, DefaultEventsMap>>(s);
});
done();
Expand Down

0 comments on commit fd9dd74

Please sign in to comment.