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>
This commit is contained in:
LucienHH 2022-04-09 18:11:12 +01:00 committed by GitHub
commit cde600d51e
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
7 changed files with 88 additions and 3 deletions

13
examples/client/realm.js Normal file
View file

@ -0,0 +1,13 @@
/* 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)
})