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
|
||||
|
||||
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:
|
||||
|
||||
|
@ -285,7 +286,13 @@ Then, all you need to do is call `Cylon#api` in your robot's script:
|
|||
|
||||
```javascript
|
||||
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!
|
||||
|
|
|
@ -85,6 +85,8 @@ Cylon.api = function api(Server, opts) {
|
|||
if (_.isString(Server)) {
|
||||
var req = "cylon-api-" + Server;
|
||||
|
||||
opts.name = Server;
|
||||
|
||||
try {
|
||||
Server = require(req);
|
||||
} catch (e) {
|
||||
|
@ -112,7 +114,6 @@ Cylon.api = function api(Server, opts) {
|
|||
}
|
||||
|
||||
opts.mcp = this;
|
||||
|
||||
var instance = new Server(opts);
|
||||
this.apiInstances.push(instance);
|
||||
instance.listen();
|
||||
|
|
Loading…
Reference in New Issue