This snippet below is enough to listen to socket events with socket.io. The current events which are broadcasted are ‘block.applied’, ‘transaction.applied’, ‘scooter.registered’, ‘scooter.rental.start’, and ‘scooter.rental.finish’. Contact us if you need more events.
const socket = io('https://socket.radians.nl', {
transports: ['websocket']
});
socket.on('connect', function() {
console.log('Connected to Radians!');
});
socket.on('error', function(data) {
console.error(data);
});
socket.on('block.applied', function(data) {
console.dirxml(data);
});
The snippet above results in: