We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
1 parent 33cd0c5 commit 466f866Copy full SHA for 466f866
README.md
@@ -118,7 +118,13 @@ import TcpSocket from 'react-native-tcp-socket';
118
### Client
119
```javascript
120
// Create socket
121
-const client = TcpSocket.createConnection(options);
+const client = TcpSocket.createConnection(options, () => {
122
+ // Write on the socket
123
+ client.write('Hello server!');
124
+
125
+ // Close socket
126
+ client.destroy();
127
+});
128
129
client.on('data', function(data) {
130
console.log('message was received', data);
@@ -131,12 +137,6 @@ client.on('error', function(error) {
131
137
client.on('close', function(){
132
138
console.log('Connection closed!');
133
139
});
134
-
135
-// Write on the socket
136
-client.write('Hello server!');
-// Close socket
-client.destroy();
140
```
141
142
### Server
0 commit comments