Rapsssito / react-native-tcp-socket

React Native TCP socket API for Android, iOS & macOS with SSL/TLS support.
MIT License
316 stars 82 forks source link

net.createServer(options, listener) is not supported #183

Open achingbrain opened 9 months ago

achingbrain commented 9 months ago

Description

net.createServer has an optional options argument as the first parameter - https://nodejs.org/api/net.html#netcreateserveroptions-connectionlistener

This module expects the first option to be a listener:

https://github.com/Rapsssito/react-native-tcp-socket/blob/3b7ac048fc035c015caa614541570b9d7d4563b9/src/index.js#L8-L14

Steps to reproduce

const server = net.connect({
  noDelay: true,
  keepAlive: true
}, () => {
  console.info('server started')
})

Current behavior

An error is thrown

TypeError: The listener must be a function

Expected behavior

The options object should be supported.

Relevant information

OS iOS
react-native 0.72
react-native-tcp-socket 6.0.6