import * as signalR from '@microsoft/signalr'
export interface KbxExperimentChangedEvent { experimentId:string; screenId:string; changedAt:string }
export function createExperimentRolloutConnection(url='/hubs/kbx-experiments'){
 const hub=new signalR.HubConnectionBuilder().withUrl(url).withAutomaticReconnect().build()
 return {start:()=>hub.state===signalR.HubConnectionState.Disconnected?hub.start():Promise.resolve(),stop:()=>hub.stop(),onChanged:(callback:(event:KbxExperimentChangedEvent)=>void)=>hub.on('ExperimentChanged',callback)}
}
