Updated README with cylon-api-socketio plugin reference.
This commit is contained in:
parent
e2f617c995
commit
cfd37e9621
|
@ -274,7 +274,8 @@ For more info on browser support, and for help with different configurations, yo
|
||||||
|
|
||||||
## API
|
## API
|
||||||
|
|
||||||
Cylon's HTTP API plugin can be used to interact with your robots remotely.
|
Cylon.js has support for different API plugins that can be used to interact with your robots remotely. At this time we have support for `http` and `socket.io` plugins
|
||||||
|
with more comming in the near future.
|
||||||
|
|
||||||
To use it, install it alongside Cylon:
|
To use it, install it alongside Cylon:
|
||||||
|
|
||||||
|
@ -285,7 +286,13 @@ Then, all you need to do is call `Cylon#api` in your robot's script:
|
||||||
|
|
||||||
```javascript
|
```javascript
|
||||||
var Cylon = require("cylon");
|
var Cylon = require("cylon");
|
||||||
Cylon.api();
|
|
||||||
|
// For http
|
||||||
|
Cylon.api('http');
|
||||||
|
|
||||||
|
// Or for Socket.io
|
||||||
|
Cylon.api('socketio');
|
||||||
|
|
||||||
```
|
```
|
||||||
|
|
||||||
Then visit `https://localhost:3000/` and you are ready to control your robots from a web browser!
|
Then visit `https://localhost:3000/` and you are ready to control your robots from a web browser!
|
||||||
|
|
|
@ -85,6 +85,8 @@ Cylon.api = function api(Server, opts) {
|
||||||
if (_.isString(Server)) {
|
if (_.isString(Server)) {
|
||||||
var req = "cylon-api-" + Server;
|
var req = "cylon-api-" + Server;
|
||||||
|
|
||||||
|
opts.name = Server;
|
||||||
|
|
||||||
try {
|
try {
|
||||||
Server = require(req);
|
Server = require(req);
|
||||||
} catch (e) {
|
} catch (e) {
|
||||||
|
@ -112,7 +114,6 @@ Cylon.api = function api(Server, opts) {
|
||||||
}
|
}
|
||||||
|
|
||||||
opts.mcp = this;
|
opts.mcp = this;
|
||||||
|
|
||||||
var instance = new Server(opts);
|
var instance = new Server(opts);
|
||||||
this.apiInstances.push(instance);
|
this.apiInstances.push(instance);
|
||||||
instance.listen();
|
instance.listen();
|
||||||
|
|
Loading…
Reference in New Issue