Skip to content

Accept port as number #1444

@aghArdeshir

Description

@aghArdeshir

Is your feature request related to a problem? Please describe.
I believe defining port on io client library seems a better suit if it's type was a number. Probably most people using socket.io on frontend and backend use a common variable for port, e.g. export const SERVER_PORT = 3000 in my case. And with current implementation and TypeScript definitions I am not allowed to pass SERVER_PORT directly to io and need to do a manual .toString() on it. (or keep my server port in two places)

Describe the solution you'd like
I think it's best for socket-io.client's exported property io to accept port as both number and string and convert number to string underneath if necessary.

Describe alternatives you've considered
When developers think of port, they think of numbers. I even believe a breaking change wouldn't be bad at all

Additional context

image

Metadata

Metadata

Assignees

No one assigned

    Labels

    enhancementNew feature or request

    Type

    No type

    Projects

    No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions