question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Accept `port` as `number`

See original GitHub issue

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

Issue Analytics

  • State:closed
  • Created 3 years ago
  • Comments:5 (2 by maintainers)

github_iconTop GitHub Comments

2reactions
saurabhmehta1601commented, Feb 21, 2021

I am new to open source and I want to give my contribution ❤. Is someone else working on it ??

1reaction
darrachequesnecommented, Apr 13, 2022
Read more comments on GitHub >

github_iconTop Results From Across the Web

What are port numbers and how do they work? - TechTarget
A port number is a way to identify a specific process to which an internet or other network message is to be forwarded...
Read more >
Does the port change when a server accepts a TCP connection?
The new socket will have a different client port number (the remote port from the server's point of view).
Read more >
Opening a port on Linux | DigitalOcean
So input your server IP and the port number, which is 4000 in my case, and run this command. telnet localhost 4000. Copy....
Read more >
Examples of how to open firewall ports - IBM
Enter the desired port range in the from-port-start:to-port-end format and specify the protocol (TCP or UDP). For example, enter 60000:60010 to open ports...
Read more >
How to choose open port number? - Super User
Generally you should just use port 80 for ease of access. Anything else would require something like 123.456. 789.0:8080 or example:8080 .
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found