I am trying to use websocket in my website.
I referred ic-websocket-cdk-mo and ic-websockets-chat-mo.
But getting error.
My code :
class wsServices {
constructor() {
this.ws = null;
}
init({ _identity,actor}) {
try{
this.ws = new IcWebSocket(gatewayUrl, undefined, {
canisterId: canisterId,
canisterActor : actor,
identity:_identity,
networkUrl: icUrl,
});
return true
}
catch(e){
console.error('initWs error', e)
return false
}
}
}
const wsServiceInstance = new wsServices();
export default wsServiceInstance;