const WebSocket = require('ws');
async function connectToWebSocket() {
const ws = new WebSocket('wss://api.assisfy.ai', {
headers: {
Authorization: `Bearer ${process.env.ASSISFY_API_KEY}`,
},
});
ws.on('open', () => {
console.log("WebSocket connection established");
});
ws.on('message', (data) => {
console.log("Received message:", JSON.parse(data));
});
ws.on('error', (error) => {
console.error("WebSocket error:", error);
});
ws.on('close', () => {
console.log("WebSocket connection closed");
});
}
connectToWebSocket();