[SDK Version]
‘sendbird-calls:1.10.2’
[Frequency]
Everytime
Hello,
I’m a user of Angular and Typescript, and using Calls SDK for Javascript.
The problem is occurred after successfully authenticated with Call server.
When I execute SendbirdCall.connectWebSocket()
, I receive this error.
What can i do to fix this error?
Thanks.
TypeError: Cannot read properties of null (reading 'readyState')
at SendBirdCall.min.js:6:376395
at new ZoneAwarePromise (zone.js:1429:1)
at e.value (SendBirdCall.min.js:6:376277)
at e.value (SendBirdCall.min.js:6:379586)
at e.value (SendBirdCall.min.js:20:4971)
at Function.value (SendBirdCall.min.js:20:13876)
at call.services.ts:34:13
at Generator.next (<anonymous>)
at asyncGeneratorStep (asyncToGenerator.js:3:1)
at _next (asyncToGenerator.js:25:1)
Here are my codes,
- CallService Class
export class CallService { user: SendbirdCall.User | undefined; init() { if (!APP_ID) return; SendbirdCall.init(APP_ID); } async login(userId: string, accessToken: string) { // Authenticate with Call Server try { const user = await SendbirdCall.authenticate({ userId: userId, accessToken: accessToken, }); this.user = user; console.log(`User Authenticated with Call server: ${user.userId}`, user); } catch (err) { console.log('Failed to authenticate with Call server \n', err); } // Connect websocket to server try { await SendbirdCall.connectWebSocket(); console.log('Succeed to connect to WebSocket'); } catch (err) { console.log('Failed to connect to WebSocket \n', err); } }
- AppComponent Class
export class AppComponent implements OnInit { ... constructor(private callService: CallService) {} async ngOnInit() { this.callService.init(); await this.callService.login( USER_ID, USER_ACCESS_TOKEN ); } ...