Skip to content

Commit

Permalink
fix: Remove timeout from connection parameters
Browse files Browse the repository at this point in the history
  • Loading branch information
Rapsssito committed Sep 30, 2022
1 parent 5473481 commit 16fea0b
Show file tree
Hide file tree
Showing 2 changed files with 0 additions and 5 deletions.
1 change: 0 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -368,7 +368,6 @@ Here are listed all methods implemented in `react-native-tcp-socket` that imitat
| -------------- | ----------- | :-------: | :-----: | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ |
| **`port`** | `<number>` ||| **Required**. Port the socket should connect to. |
| `host` | `<string>` ||| Host the socket should connect to. IP address in IPv4 format or `'localhost'`. **Default**: `'localhost'`. |
| `timeout` | `<number>` ||| If set, will be used to call [`setTimeout(timeout)`](https://nodejs.org/api/net.html#net_socket_settimeout_timeout_callback) after the socket is created, but before it starts the connection. |
| `localAddress` | `<string>` ||| Local address the socket should connect from. If not specified, the OS will decide. It is **highly recommended** to specify a `localAddress` to prevent overload errors and improve performance. |
| `localPort` | `<number>` ||| Local port the socket should connect from. If not specified, the OS will decide. |
| `interface` | `<string>` ||| Interface the socket should connect from. If not specified, it will use the current active connection. The options are: `'wifi', 'ethernet', 'cellular'`. |
Expand Down
4 changes: 0 additions & 4 deletions src/Socket.js
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,6 @@ import { nativeEventEmitter, getNextId } from './Globals';
* @typedef {{
* port: number;
* host?: string;
* timeout?: number,
* localAddress?: string,
* localPort?: number,
* interface?: 'wifi' | 'cellular' | 'ethernet',
Expand Down Expand Up @@ -163,9 +162,6 @@ export default class Socket extends EventEmitter {
this.once('connect', () => {
if (callback) callback();
});
// Timeout
if (customOptions.timeout) this.setTimeout(customOptions.timeout);
else if (this._timeout) this._activateTimer();
this._connecting = true;
this._readyState = 'opening';
Sockets.connect(this._id, customOptions.host, customOptions.port, customOptions);
Expand Down

0 comments on commit 16fea0b

Please sign in to comment.