Create nethernet_local.js
This commit is contained in:
parent
6dd0b712d5
commit
bd9229b0c9
1 changed files with 22 additions and 0 deletions
22
examples/client/nethernet_local.js
Normal file
22
examples/client/nethernet_local.js
Normal file
|
|
@ -0,0 +1,22 @@
|
|||
process.env.DEBUG = 'minecraft-protocol'
|
||||
|
||||
const { Client } = require('node-nethernet')
|
||||
const { createClient } = require('bedrock-protocol')
|
||||
|
||||
const c = new Client()
|
||||
|
||||
c.once('pong', (pong) => {
|
||||
c.close()
|
||||
|
||||
const client = createClient({
|
||||
transport: 'nethernet', // Use the Nethernet transport
|
||||
networkId: pong.senderId,
|
||||
useSignalling: false
|
||||
})
|
||||
|
||||
let ix = 0
|
||||
client.on('packet', (args) => {
|
||||
console.log(`Packet ${ix} recieved`)
|
||||
ix++
|
||||
})
|
||||
})
|
||||
Loading…
Add table
Add a link
Reference in a new issue