PrismarineJS / bedrock-protocol

Minecraft Bedrock protocol library, with authentication and encryption
https://prismarinejs.github.io/minecraft-data/?v=bedrock_1.17.10&d=protocol
MIT License
308 stars 72 forks source link

ping example question #509

Closed waternoob1005 closed 3 months ago

waternoob1005 commented 3 months ago
RakTimeout [Error]: Ping timed out
    at C:\Users\1\Desktop\TSPL\node_modules\bedrock-protocol\src\rak.js:75:13
    at waitFor (C:\Users\1\Desktop\TSPL\node_modules\bedrock-protocol\src\datatypes\util.js:30:32)
    at async ping (C:\Users\1\Desktop\TSPL\node_modules\bedrock-protocol\src\createClient.js:89:41)

Node.js v21.7.1

when this error occurs, how can I just know that an error has occurred instead of ending with an error?

extremeheat commented 3 months ago

You catch the exception with the error event, then reconnect.