import ws from 'ws';

process.env["NODE_TLS_REJECT_UNAUTHORIZED"]="0"

let good = new ws.WebSocket('wss://127.0.0.1:8080/ws', {headers: {
  ["X-Api-Key"]: "simpletest2025_001",
}}) 

good.on('error', console.error)
good.on('open', ()=>{
  console.log('good connected')
})
good.on('close', ()=>{
  console.log('good disconnected')
})


let bad = new ws.WebSocket('wss://127.0.0.1:8080/ws')

bad.on('message', (data)=>{
  console.log("agent -> bad:")
  console.log(data.toString())
})
bad.on('error', console.error)
bad.on('open', ()=>{
  console.log('bad connected')
})
bad.on('close', ()=>{
  console.log('bad disconnected')
})



