This is a minimal library that wraps socket.io-client to provide typings to the api. Below is a minimal example of how to use the api.
import { make_client, topics } from '../lib';
const client = make_client('http://localhost:8000');
client.emit('subscribe', 'door_states');
client.on('door_states', console.log);
The api server uses a pretty barebones system built off from socket.io. Refer to the socket.io docs for information regarding the protocol.
There is only one room which the client should emit to, the subscribe room. The args should be a string containing to room to subscribe to,
client.emit('subscribe', 'door_states');
upon subscription to a room, the client will:
doorStates room/topic will immediate receive all the last known door states, similarly, subscribing to doorHealth will receive all the last known door health statuses.after emitting subscribe, the client should listen to events
client.on('door_states', console.log);
Requirements:
After installing all the dependencies,
cd ~/rmf-web/packages/api-client
source ~/rmf-web/.venv/bin/activate
./generate-openapi.sh