š°Getting Started | ā**Updates |** š Guides | š¢ API | āFAQ
Web Editor Basics
HoloLens
Mobile
Meta Quest
Chapter Series Documentation
Assets
Scripting
Enklu Embedded
API Reference
Release Notes
FAQ
Contact
Every experience developed onĀ Enklu CloudĀ is backed by a powerful mutliplayer service, Mycelium. The goal of this SDK is to provide external applications and devices with session-based access to experiences via Mycelium. With this SDK, you can send and receive messages to Enklu Cloud from your own servers, IoT devices, custom applications, and whatever else you can imagine.
Enklu Cloud's behavior scripting can be used to create multiplayer experiences, as documentedĀ here.
This SDK is designed for users who have specific use cases that require multiplayer code to be running externally from user devices.
In the future, an NPM module will be available. Currently, it can be cloned directly fromĀ GitHub.
AnĀ Enklu CloudĀ account is required to use this SDK. Once you have an account set up, you can generate a token for the authoring API.
curl -X POST '<https://cloud.enklu.com:10001/v1/email/signin>' \\
-H 'Content-Type: application/json' \\
-d '{"email":"[email protected]","password":"12345"}'
Copy
TheĀ token
Ā value received in a successful response can then be used to generate a multiplayer token. Each token is associated with a specific experience, so an experience Id is required as well. You can find the app id for an experience on the "My Experiences" modal or in the Inspector panel when the root element of an experience is selected in theĀ Enklu CloudĀ web editor.
curl -X POST '<https://cloud.enklu.com:10001/v1/app/${your-app-id}/token>' \\
-H 'Authorization: Bearer ${your-jwt-token}' \\
-H 'Content-Type: application/json' \\
-d '{}'
Copy
A successful respnse will contain a Json Web Token that can be used in the SDK. Now you can start sending messages.
const {Mycelium} = require('enklu-node-sdk');
const JWT = process.env.JWT;
const mycelium =new Mycelium();
let isLoggedIn = false;
mycelium.on('message', (msg) => {
console.log(`received ${msg.event} event`);
if (msg.event === 'LoginResponse') {
isLoggedIn = true;
}
if (isLoggedIn) {
mycelium.broadcast('ping', 'hello from the sdk');
}
});
mycelium.on('connect', () => {
console.log('connected to mycelium!');
mycelium.login(JWT);
});
mycelium.connect();
Copy
A more comprehensive API reference is available onĀ GitHub.
Next: Installing Enklu Embedded
Sidebar Table of Contents
Copyright Ā© 2021 Enklu, Inc.