Giter VIP home page Giter VIP logo

Comments (17)

Rapsssito avatar Rapsssito commented on May 18, 2024

@Overtorment, thanks for your feature request. SSL was not planned originally, but I will take a closer look.

I might have to investigate about CocoaAsyncSockets known bugs with SSL. I will update you with any news about this topic.

from react-native-tcp-socket.

Overtorment avatar Overtorment commented on May 18, 2024

If this helps, I'm currently using https://github.com/wfilleman/react-native-tcp in production which has TLS for both ios and android, but I don't feel confident in this package. So I'm having hopes for this package to maybe be a superior one 🙏

from react-native-tcp-socket.

Rapsssito avatar Rapsssito commented on May 18, 2024

Thanks for the reference, it helps a lot. I will take a look at their implementation and perform some tests.

I'll update ASAP with more information.

from react-native-tcp-socket.

Overtorment avatar Overtorment commented on May 18, 2024

from react-native-tcp-socket.

Rapsssito avatar Rapsssito commented on May 18, 2024

@Overtorment, I have created a development branch for the SSL/TLS support.

If you want to check it out, you can add it to your project with the following command:

yarn add https://github.com/Rapsssito/react-native-tcp-socket#tls

from react-native-tcp-socket.

Overtorment avatar Overtorment commented on May 18, 2024

Is there a way to just ignore certificate check? We have a use case of users connecting to their own servers with self-signed certificates, so we don't know them in advance

from react-native-tcp-socket.

Rapsssito avatar Rapsssito commented on May 18, 2024

@Overtorment, I am working on a way to ignore all certificate check. I will continue updating the tls branch with all the new features.

Right now, there is Android and iOS support for standard TLS checks and locally known self-signed certificates.

from react-native-tcp-socket.

Rapsssito avatar Rapsssito commented on May 18, 2024

@Overtorment, there is a way to ignore all certificate checks: you must set tlsCheckValidity to false in your createConnection() options. For more info, take a look at the documentation on the tls branch.

Right now, Android and iOS TCP clients are TLS/SSL compatible. Can you test it in your project and report the problems you find? If there are no issues, I will release a new version with the client SSL/TLS support.

from react-native-tcp-socket.

Overtorment avatar Overtorment commented on May 18, 2024

Will do!

from react-native-tcp-socket.

Overtorment avatar Overtorment commented on May 18, 2024

success. tested tls/android. didn't test clearnet tcp and ios.
seems to work okay but there are some issues:

  1. there are no methods setNoDelay, setKeepAlive, setEncoding. I commented them out, but they are available for sockets on all platforms I think.
  2. a bit annoying that lib API does not conform to the one described in nodejs documentation. no big deal but I write isomorphic code and reuse it under RN environment and under nodejs environment. that means I will have to write more workarounds. example: createConnection creates a socket and connects it, while net package exposes sockets and allows you to connect later.
    similar with nodejs tls package: it doesn't allow you to create socket, but creates connection on the spot, but method name is different (tls.connect) and arguments have different names.

PS. cant test IOS atm

from react-native-tcp-socket.

Rapsssito avatar Rapsssito commented on May 18, 2024

@Overtorment, glad to hear it worked! I am sorry about those issues.

The methods setNoDelay, setKeepAlive, setEncoding are not implemented yet. I will update the documentation to make it clear.

The react-native-tcp-socket available API changes significantly from node net and tls because I am limited by my free time and native code development. The objective of this library is to provide a React Native API for TCP in both Android and iOS. That is why, right now, I am merging net and tls API's surfaces into one, so it is normal to have some differences.

All the available interface is in the documentation. If you have any questions, feel free to open an issue. I hope this library is good enough to suit your project!

PS: I will change the tlsCheckValidity to rejectUnauthorized to make things easier for you ;)

from react-native-tcp-socket.

Overtorment avatar Overtorment commented on May 18, 2024

I think those methods you just need to proxy-call socket object on native system, you don’t need to implement anything.

So are you keeping lib api as is? Just to make sure, if it stays like this - it stays, that’s fine, just to know there won’t be any breaking changes :-)

from react-native-tcp-socket.

Rapsssito avatar Rapsssito commented on May 18, 2024

There won't be any breaking changes. I will release the new version in 5 minutes.

About the methods setNoDelay, setKeepAlive and setEncoding, thanks for the tip! I will investigate. As soon as they are implemented, I will release a new version.

from react-native-tcp-socket.

github-actions avatar github-actions commented on May 18, 2024

🎉 This issue has been resolved in version 3.5.0 🎉

The release is available on:

Your semantic-release bot 📦🚀

from react-native-tcp-socket.

piyush2cloud avatar piyush2cloud commented on May 18, 2024

@Overtorment @Rapsssito

Can u please help me in this. I am trying to create Android TV Remote for IOS.

Like I wan to mimic node(tls.connect) using react native. 

I need to implement a tls connection with Android TV from IOS device to send Remote Commands.

When I send below from IOS device with tls true it throws error 
operation couldn’t be completed. (kcfstreamerrordomainssl error -9807.)
const client = TcpSocket.createConnection({    port: '6467',    host: "Android TV I.P",    **tls**: true});

When I send below with no tls key from IOS device it makes connection but data returned from Android TV is not in proper format. So I was thinking this is because tls is false in below case.
const client = TcpSocket.createConnection({    port: '6467',    host: "Android TV I.P"});

Can u please help me in this. How to make a tls connection in React Nativ from IOS. Any help would be really helpful.

from react-native-tcp-socket.

Rapsssito avatar Rapsssito commented on May 18, 2024

@piyush2cloud, if you have a problem, you should create a new issue. However, you could check nodeJS examples or seek help in stackoverflow for this kind of questions.

from react-native-tcp-socket.

punjasin avatar punjasin commented on May 18, 2024

Hi how do i pass private key in client tls do you know how ?
const options = {
// Necessary only if using the client certificate authentication
key: fs.readFileSync('client_private_key.pem'),
cert: fs.readFileSync('client_cert.pem'),
// Necessary only if the server uses the self-signed certificate
ca: fs.readFileSync('server_cert.pem'),
}
this is what I use when I am working on nodejs what do I need to add for this to work in react-native ?

from react-native-tcp-socket.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.