react-native-tcp-socket icon indicating copy to clipboard operation
react-native-tcp-socket copied to clipboard

net.createServer(options, listener) is not supported

Open achingbrain opened this issue 1 year ago • 0 comments

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

achingbrain avatar Dec 12 '23 09:12 achingbrain