Comments (17)
@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.
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.
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.
from react-native-tcp-socket.
@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.
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.
@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.
@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.
Will do!
from react-native-tcp-socket.
success. tested tls/android. didn't test clearnet tcp and ios.
seems to work okay but there are some issues:
- there are no methods
setNoDelay
,setKeepAlive
,setEncoding
. I commented them out, but they are available for sockets on all platforms I think. - 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, whilenet
package exposes sockets and allows you to connect later.
similar with nodejstls
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.
@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.
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.
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.
🎉 This issue has been resolved in version 3.5.0 🎉
The release is available on:
Your semantic-release bot 📦🚀
from react-native-tcp-socket.
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.
@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.
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)
- java.lang.IllegalArgumentException Tcp Sockets: No socket with id HOT 4
- Cannot destroy the connection from timeout while connecting HOT 2
- Wrong error message on iOS ("error in connect() function") HOT 1
- Nmap port scan crashes the entire app on iOS 16 HOT 2
- tls authentication support ? HOT 2
- Question how to i perform tls authentication handshake HOT 1
- java.io.IOException: Interface wifi unreachable HOT 1
- Socket remains open after reloading in react-native HOT 1
- android close on reload HOT 1
- How to set up cross domain on the server HOT 1
- How to reconnect immediately to the same socket instance HOT 3
- Bug on TcpSocket.createConnection after creating/destroying 4/5 times HOT 2
- TypeError: Cannot read property 'connect' of null, js engine: hermes HOT 5
- net.createServer(options, listener) is not supported
- Using a pinned certificate will always incorrectly trust peer on iOS HOT 1
- server.on(connection , socket => {} ) not working
- Minor inconsistency with node's net api HOT 1
- Request: Support React Native Architure
- Attempt to invoke virtual method 'java.io.InputStream java.net.Socket.getInputStream()' on a null object reference HOT 3
- TLS Connection
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
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.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from react-native-tcp-socket.