fleet/frontend/kolide/websockets.js
Zach Wasserman 7a68e3de65
Deprecate /api/v1/kolide routes (#297)
- Support both /api/v1/fleet and /api/v1/kolide routes in server.
- Add logging for use of deprecated routes.
- Rename routes in frontend JS.
- Rename routes and add notes in documentation.
2021-02-10 12:13:11 -08:00

23 lines
620 B
JavaScript

import SockJS from 'sockjs-client';
import local from 'utilities/local';
export default (client) => {
return {
queries: {
run: (campaignID) => {
return new Promise((resolve) => {
const socket = new SockJS(`${client.baseURL}/v1/fleet/results`, undefined, {});
socket.onopen = () => {
socket.send(JSON.stringify({ type: 'auth', data: { token: local.getItem('auth_token') } }));
socket.send(JSON.stringify({ type: 'select_campaign', data: { campaign_id: campaignID } }));
};
return resolve(socket);
});
},
},
};
};