Skip to content

docs: document main namespace shortcuts - #5517

Open
nightt5879 wants to merge 1 commit into
socketio:mainfrom
nightt5879:nightt5879/docs-server-main-namespace-shortcuts
Open

docs: document main namespace shortcuts#5517
nightt5879 wants to merge 1 commit into
socketio:mainfrom
nightt5879:nightt5879/docs-server-main-namespace-shortcuts

Conversation

@nightt5879

Copy link
Copy Markdown

Fixes #4608

Summary

  • Document that Server methods like io.on(connection), io.use(...), and io.emit(...) are shortcuts for the main namespace.
  • Add a short io.sockets note for the main namespace property.

Verification

  • npx --yes prettier@3.3.2 --check packages/socket.io/lib/index.ts
  • git diff --check

@Edgarruiz8585

Copy link
Copy Markdown

Fixes #4608
By Edgarruiz8585

Summary

  • Document that Server methods like io.on(connection), io.use(...), and io.emit(...) are shortcuts for the main namespace.
  • Add a short io.sockets note for the main namespace property.
    Edgarruiz8585

Verification

  • npx --yes prettier@3.3.2 --check packages/socket.io/lib/index.ts
  • git diff --check

* shortcuts for calling the same methods on this namespace.
*
* @example
* io.sockets.emit("hello");

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

  • by Edgarruiz8585

* io.compress(false).emit("hello");
*
* @param compress - if `true`, compresses the sending data
* @return a new {@link BroadcastOperator} instance for chaining

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

  • @Edgarruiz8585

@Edgarruiz8585

Copy link
Copy Markdown

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Docs: Document io.on, io.use etc in the Server API docs

2 participants