ng2-signalr icon indicating copy to clipboard operation
ng2-signalr copied to clipboard

Possibility to modify qs after connection is started

Open liri2006 opened this issue 7 years ago • 4 comments

Hi,

I've implemented authorization by passing access token through the query string param. But I also need a possibility to replace that token once it gets updated. For now I'm able to achieve that by doing something veeery horrible: (<any>this.connection)._jConnection.qs["access_token"] = token; It would be nice to be able to do it in typescript-ish way :)

liri2006 avatar Mar 28 '17 13:03 liri2006

I think you need to pass in IConnectionOptions to the connect method. something like Signalr.connect({ qs: {blabla : 'fff' }}); But this has the drawback of creating a new connection.

Do you mean changing the qs on a existing connection ? Indeed. Good feedback. Will add that in future versions...

HNeukermans avatar Mar 28 '17 13:03 HNeukermans

Wouldn't it restart existing connection? I'm doing Signalr.connect({ qs: {access_token: 'here goes token' }}); when connecting for the first time, but then I need to change query string some time after that, when access token is refreshed.

liri2006 avatar Mar 28 '17 13:03 liri2006

any update?

lneningerBelzona avatar Sep 05 '18 18:09 lneningerBelzona

@HNeukermans, is any update on this? We need to update hub's access token on token refresh

Bykiev avatar Oct 25 '21 08:10 Bykiev