Skip to content

Issue with client ID when using SPA like inertia #45

Closed
ably-forks/laravel-echo
#38
@graphem

Description

@graphem

Posting something someone already posted on stackoverflow, anyone with same issue?


I'm using ably for broadcasting notifications in my admin panel, I've followed this repo https://github.com/ably/laravel-broadcaster, to setup ably/laravel-broadcaster and ably larvel echo for the client side I did ably laravel echo configuration in bootstrap.js as mentioned exactly in the repo

import Echo from '@ably/laravel-echo';
import * as Ably from 'ably';

window.Ably = Ably;
window.Echo = new Echo({
broadcaster: 'ably',
disconnectedRetryTimeout: 500
});
window.Echo.connector.ably.connection.on(stateChange => {
console.log(stateChange.current);
// if (stateChange.current === 'connected') {
// console.log('connected to ably server');
// }
});
everything works fine and notification is being broadcasted and received, but after the user login in my app laravel echo connection failes cuz of a clientId mismatch

Ably: Connection state: failed; reason: [ErrorInfo2: Mismatched clientId for existing connection; statusCode=401; code=40102; see https://help.ably.io/error/40102 ]
if I refreshed the page everything works fine again, it looks like after the client login, ably isn't updating the client id

Note 1: it worth mentioning that I'm using laravel inertia with vue to build my SPA applications

can anyone help? actually I don't know where to start


I am not sure if we can force the client_id to ably as usually the laravel broadcasting auth takes care of this

┆Issue is synchronized with this Jira Task by Unito

Metadata

Metadata

Assignees

Labels

bugSomething isn't working. It's clear that this does need to be fixed.

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions