Skip to content

Commit fae4315

Browse files
committed
Reformatted project
1 parent 69d61c6 commit fae4315

File tree

4 files changed

+46
-16
lines changed

4 files changed

+46
-16
lines changed
Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,10 @@
1-
let { TCPClient } = require('./TCPService');
1+
let { TCPClient } = require('../Limitless-TCP');
22

33
let tcpClient = new TCPClient('127.0.0.1', 1234, true);
44

55
tcpClient.connect();
66

77
tcpClient.on('connect', () => {
8-
console.log('s')
98
tcpClient.emit({type: 'test', data: 'This is a test packet 1'});
109
tcpClient.emit({type: 'test', data: 'This is a test packet 2'});
1110
tcpClient.emit('Yo 1');
Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
let { TCPServer } = require('./TCPService')
1+
let { TCPServer } = require('../Limitless-TCP')
22

33
let tcpServer = new TCPServer(1234, true);
44

File renamed without changes.

README.md

Lines changed: 44 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -21,13 +21,27 @@ Required Modules:
2121

2222
# Getting started
2323
## Client:
24-
```javascript
25-
let { TCPClient } = require('TCPService');
2624

27-
let tcpClient = new TCPClient(str: address, num: port, bool: useHeartbeat);
25+
```javascript
26+
let {TCPClient} = require('Limitless-TCP');
27+
28+
let tcpClient = new TCPClient(str
29+
:
30+
address, num
31+
:
32+
port, bool
33+
:
34+
useHeartbeat
35+
)
36+
;
2837
tcpClient.connect();
29-
30-
tcpClient.on(str: event, (callback) => {});
38+
39+
tcpClient.on(str
40+
:
41+
event, (callback) => {
42+
}
43+
)
44+
;
3145
tcpClient.emit(data);
3246
```
3347

@@ -61,15 +75,15 @@ server.on('connection', (socket) => {
6175
Note that the data returned is as a buffer because that is how tcp sends data, and the packets sent by the client are sent as stacked because they were sent too fast.
6276

6377
#### Client:
78+
6479
```javascript
65-
let { TCPClient } = require('./TCPService');
80+
let {TCPClient} = require('./Limitless-TCP');
6681

6782
let tcpClient = new TCPClient('127.0.0.1', 1234, true);
6883

6984
tcpClient.connect();
7085

7186
tcpClient.on('connect', () => {
72-
console.log('s')
7387
tcpClient.emit({type: 'test', data: 'This is a test packet 1'});
7488
tcpClient.emit({type: 'test', data: 'This is a test packet 2'});
7589
tcpClient.emit('Yo 1');
@@ -79,14 +93,31 @@ tcpClient.on('connect', () => {
7993
This will not work the other way around, meaning you are not able to connect a normal tcp client to a Limitless TCP server.
8094

8195
## Server:
82-
```javascript
83-
let { TCPServer } = require('TCPService');
8496

85-
let tcpServer = new TCPServer(num: port, bool: useHeartbeat)
97+
```javascript
98+
let {TCPServer} = require('Limitless-TCP');
99+
100+
let tcpServer = new TCPServer(num
101+
:
102+
port, bool
103+
:
104+
useHeartbeat
105+
)
86106
tcpServer.listen();
87107

88-
tcpServer.on(str: event, null/socket: socket, (callback) => {}); //If the socket field is null then it listens for tcpServer events instead of socket specific
89-
tcpServer.emit(data, socket: socket);
108+
tcpServer.on(str
109+
:
110+
event, null / socket
111+
:
112+
socket, (callback) => {
113+
}
114+
)
115+
; //If the socket field is null then it listens for tcpServer events instead of socket specific
116+
tcpServer.emit(data, socket
117+
:
118+
socket
119+
)
120+
;
90121
```
91122

92123
### Connected Sockets and All Sockets:
@@ -116,7 +147,7 @@ Refer to tcp docs for callback information
116147
There is a different error that is thrown when the heartbeats timeout. This error is the same on the server and the client.
117148
```bash
118149
TCPServiceError [Heartbeat Error]: The heartbeat counter has timed out
119-
at Timeout._onTimeout (Path\To\TCPService.js:225:43)
150+
at Timeout._onTimeout (Path\To\Limitless-TCP.js:225:43)
120151
at listOnTimeout (node:internal/timers:564:17)
121152
at process.processTimers (node:internal/timers:507:7) {
122153
Details: 'This socket has timed out from the server.'

0 commit comments

Comments
 (0)