You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: README.md
+8Lines changed: 8 additions & 0 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -26,10 +26,14 @@ let client = new QueryClient();
26
26
27
27
let basic =awaitclient.queryBasic('localhost', 25565, AbortSignal.timeout(5000));
28
28
let full =awaitclient.queryFull('localhost', 25565, AbortSignal.timeout(5000));
29
+
30
+
awaitclient.close();
29
31
```
30
32
Basic and full query requests will return a [`BasicStatResponse`](src/Packet/Query/BasicStatResponse.js)
31
33
and [`FullStatResponse`](src/Packet/Query/FullStatResponse.js) object respectively.
32
34
35
+
Note that the query client needs to be closed manually, since it keeps its UDP socket open to reuse it for future queries.
36
+
33
37
### Java Edition Ping
34
38
The [Server List Ping protocol](https://wiki.vg/Server_List_Ping) is what the Minecraft client uses to show the server status in the in-game server list.
35
39
This protocol changed multiple times over the years, so you'd ideally want to know the version of the server you are pinging to use the correct protocol version.
@@ -94,5 +98,9 @@ import {BedrockPingClient} from 'craftping';
94
98
let client =newBedrockPingClient();
95
99
96
100
let status =awaitclient.ping('localhost', 19132, AbortSignal.timeout(5000));
101
+
102
+
awaitclient.close();
97
103
```
98
104
Pinging a Bedrock server will return an [`UnconnectedPong`](src/Packet/BedrockPing/UnconnectedPong.js) object.
105
+
106
+
Note that the Bedrock ping client also needs to be closed manually, since it keeps its UDP socket open to reuse it for future requests.
0 commit comments