mhsjlw / node-raknet Goto Github PK
View Code? Open in Web Editor NEWRakNet implementation in JavaScript for Node.js
License: MIT License
RakNet implementation in JavaScript for Node.js
License: MIT License
I think this is the "official" RakNet implementation that Minecraft uses?
https://github.com/facebookarchive/RakNet
Could we create easier high-level Node bindings for that C++ api?
I know this isn't the proper forum for this, and I apologize for that... but for the life of me I couldn't figure out any other means of contacting @mhsjlw.
A couple years ago, you had an elixir-raknet library, but it appears to have disappeared from the internets. Do you by chance have an archive of it lying around? I'm working on an Elixir RakNet client now, and would be very grateful to get a head start, even if your project was killed before being production-grade.
12:53 also we should think about writing raknet tests at some point
12:53 like circle ci builds a copy of chat server and our client tried to connect to it
12:53 and it it get's past handshake the test passes
12:54 then we get a node-raknet server and see if the client can connect
12:54 then the test passes
Didn't tested but I bet it doesn't work since I didn't put that https://github.com/PrismarineJS/node-minecraft-protocol/blob/master/src/client/tcp_dns.js
http://wiki.vg/Pocket_Edition_Protocol_Documentation#Frame_Set_Packet
turns out raklib is ignoring some case that never happen in mcpe : "Sequenced frame index" here
let's put https://www.npmjs.com/package/datagram-stream#unicast in a client.js (see https://github.com/mhsjlw/minecraft-classic-protocol/blob/master/src/client.js )
There are still a few hardcoded values in the code. It works so it's not a big deal but better generate them properly (example : serverid)
because ipv6 > ipv4
A simple raknet client might be interesting to test a raknet server
Example:
{"seqNumber":7,"encapsulatedPackets":[{"reliability":3,"hasSplit":16,"length":1432,"messageIndex":6,"orderIndex":1,"orderChannel":0,"splitCoun
t":12,"splitID":0,"splitIndex":4
http://wiki.vg/Pocket_Edition_Protocol_Documentation#Connected_Pong
https://github.com/PocketMine/RakLib/blob/master/protocol/PONG_DataPacket.php
"i believe it reads packets that are too short as 0s"
"so it might just work but it's technically wrong"
I believe that should work.
Just got to figure out how that work for custom packets.
23:07 < javaprophet> Set bind-port to 0, and it will act like TCP, where the Os automatically sets that up.
Got the following code:
const RakNet = require('node-raknet')
const client = RakNet.createClient({
host: '128.116.65.156',
port: 50945,
mtuSize: 1156,
password: "374f5e116c45"
})
client.on('connect', function () {
console.info('Connected')
})
client.on('login', () => {
console.log('Logged in')
})
client.on('error', function (err) {
console.log(err)
})
client.on('data', function (data) {
console.log(data)
})
Password is set to 374f5e116c45
. But when I monitor packages using Wireshark it says RakNet Password: 333734663565313136633435
. And that's not the password Ive send through.
This is what's shown in the HEX dump + ascii dump:
33 37 34 66 35 65 31 31 36 63 34 35 374f5e116c45
But it's just weird that it shows what's the value of the HEX dump instead of the actual password.
Hi,
I'm using the following repository: https://github.com/mhsjlw/node-raknet which uses Protodef. I've got the following error:
Error: Deserialization error for : Read error for name : 20 is not in the mappings value
at ProtoDef.readMapper (C:\Users\AaronJ\Documents\Raknet.js\node_modules\protodef\src\datatypes\utils.js:30:34)
at ProtoDef.read (C:\Users\AaronJ\Documents\Raknet.js\node_modules\protodef\src\protodef.js:110:29)
at C:\Users\AaronJ\Documents\Raknet.js\node_modules\protodef\src\datatypes\structures.js:45:32
at tryCatch (C:\Users\AaronJ\Documents\Raknet.js\node_modules\protodef\src\utils.js:50:16)
at tryDoc (C:\Users\AaronJ\Documents\Raknet.js\node_modules\protodef\src\utils.js:54:10)
at C:\Users\AaronJ\Documents\Raknet.js\node_modules\protodef\src\datatypes\structures.js:44:5
at Array.forEach (<anonymous>)
at ProtoDef.readContainer (C:\Users\AaronJ\Documents\Raknet.js\node_modules\protodef\src\datatypes\structures.js:43:12)
at ProtoDef.read (C:\Users\AaronJ\Documents\Raknet.js\node_modules\protodef\src\protodef.js:36:25)
at ProtoDef.read (C:\Users\AaronJ\Documents\Raknet.js\node_modules\protodef\src\protodef.js:110:29)
at e.message (C:\Users\AaronJ\Documents\Raknet.js\node_modules\protodef\src\protodef.js:149:49)
at tryCatch (C:\Users\AaronJ\Documents\Raknet.js\node_modules\protodef\src\utils.js:50:16)
at ProtoDef.parsePacketBuffer (C:\Users\AaronJ\Documents\Raknet.js\node_modules\protodef\src\protodef.js:149:29)
at Parser.parsePacketBuffer (C:\Users\AaronJ\Documents\Raknet.js\node_modules\protodef\src\serializer.js:36:23)
at Parser._transform (C:\Users\AaronJ\Documents\Raknet.js\node_modules\protodef\src\serializer.js:44:23)
at Parser.Transform._read (C:\Users\AaronJ\Documents\Raknet.js\node_modules\readable-stream\lib\_stream_transform.js:177:10)
at Parser.Transform._write (C:\Users\AaronJ\Documents\Raknet.js\node_modules\readable-stream\lib\_stream_transform.js:164:83)
at doWrite (C:\Users\AaronJ\Documents\Raknet.js\node_modules\readable-stream\lib\_stream_writable.js:409:139)
at writeOrBuffer (C:\Users\AaronJ\Documents\Raknet.js\node_modules\readable-stream\lib\_stream_writable.js:398:5)
at Parser.Writable.write (C:\Users\AaronJ\Documents\Raknet.js\node_modules\readable-stream\lib\_stream_writable.js:307:11)
at Client.handleMessage (C:\Users\AaronJ\Documents\Raknet.js\node_modules\node-raknet\src\client.js:190:17)
at Socket.<anonymous> (C:\Users\AaronJ\Documents\Raknet.js\node_modules\node-raknet\src\createClient.js:25:12)
at Socket.emit (events.js:215:7)
at UDP.onMessage [as onmessage] (dgram.js:861:8) {
field: '',
buffer: <Buffer 14>
}
Where when I go to line 30 of node_modules\protodef\src\datatypes\utils.js
, I see the following code:
if (mappedValue == null) throw new Error(value + ' is not in the mappings value')
Any fix for not finding 20?
It also happens with 24
see #3 (comment)
kind of work currently, but we don't deduplicate and we don't handle lost packets
I believe this is not quite right https://github.com/mhsjlw/node-raknet/blob/master/src/client.js#L142
https://github.com/PocketMine/RakLib/blob/master/server/Session.php#L285
$this->mtuSize - 34
check the vanilla mcpe client then split the same as we do.
and then remove that hack https://github.com/mhsjlw/node-raknet/blob/master/src/createServer.js#L36
it won't change anything about the functionnality, it'll just improve code a bit.
For both the client and the server (in createClient and createServer):
Emit the correct event when the sequence is done.
for example not data packet
A declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.