node's net API in React Native
This module is used by Peel
npm install gajjartejas/react-native-tcp --save
npx pod-install
or
cd ios && pod install && cd ..
see/run index.ios.js/index.android.js for a complete example, but basically it's just like net
const net = require("react-native-tcp");
const server = net
.createServer(function (socket) {
socket.write("excellent!");
})
.listen(12345);
const client = net.createConnection(12345);
client.on("error", function (error) {
console.log(error);
});
client.on("data", function (data) {
console.log("message was received", data);
});
- Use Typescript
PR's welcome!
originally forked from react-native-udp