You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Is your feature request related to a problem? Please describe.
I am hosting the app in front of a load balancer that does the Authentication and the results are sent as HTTP Headers to the Application. I would like to access the username from the Headers that are passed in. However I cannot find a callback to access the values.
Describe the solution you'd like
Would be great if we can have the HTTP headers made available in the @cl.on_chat_start or make it available in the UserSession object.
Describe alternatives you've considered
Create Custom Javascript to fetch the information via websockets. Not all hosting environments support WS connection. Also, having it part of the built in callbacks and API is cleaner.
The text was updated successfully, but these errors were encountered:
You can do this in socketio.pu, the @connect callback receives the asgienviron, didn't test but you could put this at the end of @connect and try it out, just after the ws session is initialized:
Didn't check the session handling logic, not sure if these would get overwritten but mostly they seem to check if their session id is found in one of those three and if so the value is used.
It's not clear to me how the session ID flows from the ws endpoint to context.session, maybe one of those emitter events triggers this. No time to comb through it all.
If the headers don't propagate you could always add a global headers_dict at the end and in on @on_chat_start do from chainlit.socket import headers_dict and put in cl.user_session yourself.
Is your feature request related to a problem? Please describe.
I am hosting the app in front of a load balancer that does the Authentication and the results are sent as HTTP Headers to the Application. I would like to access the username from the Headers that are passed in. However I cannot find a callback to access the values.
Describe the solution you'd like
Would be great if we can have the HTTP headers made available in the @cl.on_chat_start or make it available in the UserSession object.
Describe alternatives you've considered
Create Custom Javascript to fetch the information via websockets. Not all hosting environments support WS connection. Also, having it part of the built in callbacks and API is cleaner.
The text was updated successfully, but these errors were encountered: