centrifugal / centrifuge-js

JavaScript client SDK to communicate with Centrifugo and Centrifuge-based server from browser, NodeJS and React Native. Supports WebSocket, HTTP-streaming over Fetch and Readable Stream API, EventSource, WebTransport.
https://centrifugal.dev
MIT License
411 stars 104 forks source link

getToken cb for connection token does not fire #256

Closed GadiRiversideFM closed 1 year ago

GadiRiversideFM commented 1 year ago

Describtion I'm using the Centrifuge class option getToken to retrieve new token every X timeout to fetch a new token. It seems like it's not firing if the token expires after 1 hour. It did fire on another centrifuge server env.not really sure it relates to timeout... Is there any config or some server side config missing? something else?

To Reproduce Steps to reproduce the behavior:

  1. connect to a session that expects a connection token
  2. pass a getToken callback to the Centrifuge class option and a valid token new Centrifuge("endpoint", {token: "validToken", getToken: Function})
  3. make sure token expires after one hour
  4. callback doesn't fire

Expected behavior callback should fire

Versions

Additional context example token: eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJzdWIiOiJmYTBlYzIwYS1jZWIwLTQ3OTktOWRiNy01ODQ0MGRmZWM4NTQiLCJpYXQiOjE2OTUxNDI4MzIsImV4cCI6MTY5NTE0NjQzMn0.aHVFC5MolGDaAO3AMct6mzjDUWN7kbccpge1ayRn6cE

GadiRiversideFM commented 1 year ago

Update: server config flag client_insecure was on true.issue solved

FZambia commented 1 year ago

Thanks for sharing the root cause!