Connection to the socket
To connect to the socket, you'll need a security token. Instructions for obtaining this token can be found in the 'Getting Started' section.
Our subscription service operates through the Socket.io library, which leverages websockets as a transport protocol. While it's possible to connect using plain websockets, please be aware that connecting with plain websockets would require you to implement a ping-pong mechanism to avoid potential disconnections. We strongly recommend utilizing a Socket.io library for a smoother experience. Not all socket.io client libraries will work as expected, the server uses verion 4.6, check first compatibilities with the selected client library.
It's important to note that not all Socket.io client libraries will function as expected. Our server utilizes version 4.6, so we advise you to first check for compatibility with your chosen client library to ensure a seamless connection."
Javascript - client versioon 4.x https://socket.io/docs/v4/client-api/
Python - client versioon 4.x https://python-socketio.readthedocs.io/en/latest/client.html
Step 1: Connect to the socket
SOCKET URL: https://cloud.rigi.tech
Js example:
const socketIOClient = require("socket.io-client");
var io = socketIOClient;
const url="https://cloud.rigi.tech";
const token="eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJjcmVhdGVkQXQiOjE1NTgwMTc0MTkzNzQsInVwZGF0ZWRBdCI6MTU1ODAxNzQxOTM3NCwiaWQiOjEsImVtYWlsIjoiY25wMTk4NEBnbWFpbC5jb20iLCJ1c2VybmFtZSI6ImNhcmxvcyIsImluaXRpYWxSb3V0ZSI6bnVsbCwicm9sZSI6MSwiaWF0IjoxNjI4NjEzNjk5LCJleHAiOjE2NDMwMTM2OTl9.pr-iNy3o_RG5Fzwqu80tNzVltKddbB09RTx9aEOTaeI"
const socket = io("https://cloud.rigi.tech:3000",{
transports: ['websocket'],
auth: {
token: token,
},
});
socket.on('connect', (s) => {
console.debug("connected")
//We set the boundries or the returning value will be an ampty array
s.emit("boundries", {"latBetween":[46.05591073938665,46.81869159487271],"lngBetween":[4.032461361616266,8.446218685835015]});
});
Step 2: Using the socket
After a connection is correctly stablished you need to subscribe to the socket but also set the boundries from where you want to get data. If the boundries are not set the result will be an empty array
Once you have successfully established a connection, you can begin subscribing to topics to receive real-time drone data and send commands to the drone. Detailed information on these actions can be found in the following sections.