bedrock-protocol/examples/client/realm.js
LucienHH cde600d51e
Implement Realm joining (#193)
* Pass client options to ping

* Implement RealmAPI to auth

* Add Realm join example

* Update package.json

* Update README.md

* Update index.d.ts

* Show one option, remove listener

* Fix wording

* Explain options

* Optional fields

* Fix typo

* Moved retry ad host/port extraction to prealms

* Add docs

* Fix lint

* Depend on prealms release

Co-authored-by: LucienHH <Lucien.holloway@aprox.co.uk>
2022-04-09 13:11:12 -04:00

13 lines
570 B
JavaScript

/* eslint-disable */
const bedrock = require('bedrock-protocol')
const client = bedrock.createClient({
realms: {
// realmId: '1234567', // Connect the client to a Realm using the Realms ID
// realmInvite: 'https://realms.gg/AB1CD2EFA3B', // Connect the client to a Realm using the Realms invite URL or code
pickRealm: (realms) => realms.find(e => e.name === 'Realm Name') // Connect the client to a Realm using a function that returns a Realm
}
})
client.on('text', (packet) => { // Listen for chat messages
console.log('Received Text:', packet)
})