Using Sendbird Call Javascript in Laravel/PHP cannot connect to websocket

Hi everyone,

i’m pretty new to sendbird, and trying to implement this to my laravel project.
i install sendbird call from npm and include it to my ui using SendBirdCall.min.js file

i succeeded in init, and did authentication.

but i always get this in my console. does anyone know, what i missed?

@Medikaloka_Hermina Please can you provide the code you use to authenticate your user?

In this case it looks like you might not be including a user access token or the token is wrong. Please note, that Sendbird Calls doesn’t use User Session tokens, it has to be a Sendbird User with an Access token.

Please do share the code you are using to init and log in to Sendbird Calls.

Hi Jason,
thank you for reply…

below is our code, seems my code cannot shown, so i attached image instead :pray:

@Medikaloka_Hermina Hi.

Looking at your code the first thing that springs to mind is that SendbirdCall.connectWebSocket() is being called before the authentication has completed.

Please can you move SendbirdCall.connectWebSockect() to be inside your authenticate method and see how it goes.

this is the result when i try to move it inside authentication success.


It logged successfully connected to websocket but immediately go to catch section. is it normal?

@Medikaloka_Hermina

Please can you share you app_id (please direct message me). Looking at your records, it might be that the app you are using has a free trial the ended on the 9th March 2021.

Please log into your Sendbird Dashboard, to check, and please do dm your app_id so I can double check. :slight_smile:

okay. i even tried to create new app ID, but the result are the same… i will dm you

@Medikaloka_Hermina
I think the code that handles asynchronous processing is weird.
If you proceed with the following code, you can check that it works normally.

SendBirdCall.connectWebSocket().then(result => console.log(result)).catch(error=>console.error(error))

or

SendBirdCall.connectWebSocket()
.then(function(){
   console.log("success");
})
.catch(function(error){
   console.log("error");
});

thank you so much… :heart_eyes: it works now