Package Exports
- kaia-services.js
This package does not declare an exports field, so the exports above have been automatically detected and optimized by JSPM instead. If any package subpath is missing, it is recommended to post an issue to the original package (kaia-services.js) to support the "exports" field. If that is not possible, create a JSPM override to customize the exports field for this package.
Readme
Kaia-services.js
Services provided by Kaia.ai platform.
We have not yet launched the platform. For launch announcement please follow us on Facebook.
Live Demos
- Browse sample apps for live demos, source code
Installation
Kaia.ai robot apps run on Android smartphones. To run sample apps:
- Go to kaia.ai, familiarize yourself with how the robot platform works
- Optional, but highly recommended: if you don't have Kaia.ai account, create an account
- Go to Google Play, search for "kaia.ai" to find and install Kaia.ai Android app
- Launch Kaia.ai Android app on your Android smartphone
- In Kaia.ai Android app: (optional, but highly recommended): sign in, navigate to Kaia.ai App Store
- Choose a robot app to launch
- Optionally: click the heart icon to pin the robot app to your launch screen
API Overview
Messaging
let messaging = await createMessaging({ io: io(), eventListener: onMessageEvent, rooms: 'myRoom' });
// Send string or objects
messaging.send('Hello');
messaging.send({ firstName: 'Mary', lastName: 'Jane'});
...
function onMessageEvent(err, msg) {
if (err) {
print ('Error ' + err);
return;
}
switch (msg.event) {
case 'message':
print(msg.client + ' in room ' + msg.room + ' says ' + msg.message);
break;
case 'joined':
print(' ' + msg.room + ' clients now are ' + msg.clients);
print(msg.client + ' joined room ' + msg.room);
break;
case 'left':
print(' ' + msg.room + ' clients now are ' + msg.clients);
print(msg.client + ' left room ' + msg.room);
break;
case 'reconnect':
print('Reconnected');
break;
case 'disconnect':
print('Disconnected');
break;
}
}
Installing
Via npm + webpack/rollup
npm install kaia-messaging.js
Now you can require/import kaia-messaging.js
:
import { createMessaging } from 'kaia-messaging.js';
Via <script>
dist/kaia-services.mjs
is a valid JS module.dist/kaia-services-iife.js
can be used in browsers that don't support modules.kaiaServicesJs
is created as a global.dist/kaia-services-iife.min.js
As above, but minified.dist/kaia-services-iife-compat.min.js
As above, but works in older browsers such as IE 10.dist/kaia-services-amd.js
is an AMD module.dist/kaia-services-amd.min.js
is a minified AMD module.
These built versions are also available on jsDelivr, e.g.:
<script src="https://cdn.jsdelivr.net/npm/kaia.js/dist/kaia-services-iife.min.js"></script>
<!-- Or in modern browsers: -->
<script type="module">
import { createMessaging } from 'https://cdn.jsdelivr.net/npm/kaia-services.js';
</script>
and unpkg
<script src="https://unpkg.com/kaia.js/dist/kaia-services-iife.min.js"></script>
<!-- Or in modern browsers: -->
<script type="module">
import { createMessaging } from 'https://unpkg.com/kaia-services.js';
</script>