WebSocket/ActionCable client for Sorare.
npm install @sorare/actioncable --save
const { ActionCable } = require('@sorare/actioncable');
const cable = new ActionCable({
url: 'wss://ws.sorare.com/cable',
headers: {
// 'Authorization': `Bearer <YourJWTorOAuthToken>`,
// 'APIKEY': '<YourOptionalAPIKey>'
},
});
cable.subscribe('aCardWasUpdated { id }', {
connected() {
console.log('connected');
},
disconnected() {
console.log('disconnected');
},
rejected() {
console.log('rejected');
},
received(data) {
console.log('received');
console.log(data);
},
});
@sorare/actioncable
is MIT licensed. Credits to ZackMattor/actioncable-nodejs for the initial work.