Rapsssito / react-native-tcp-socket

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

Wrong use of socket.write() in server example #85

Closed simonhoss closed 3 years ago

simonhoss commented 3 years ago

Hi

In the documentation you have the following example under https://github.com/Rapsssito/react-native-tcp-socket#server

  socket.on('data', (data) => {
    socket.write('Echo server', data);
  });

I think the correct one would be the following example, because the second parameter is the encoding or a callback, right?

  socket.on('data', (data) => {
    socket.write('Echo server ' +data);
  });
Rapsssito commented 3 years ago

@simonhoss, you are right! Thanks for pointing that out.