Janic
Explore posts from serverswsLink with external (custom) websocket?
I want to integrate an external websocket to tRPC for extra type-safety with wsLink where the url will need to be dynamic and the authentication as well.
The problem is as follows:
1) The websocket url is dynamic. It needs to be requested through an API first to get it, because the system has multiple nodes with different ports.
2) The API response of step 1 includes a authorization token which will need to be send to the connection once connected.
3) After some time the websocket server will send an message with "token expiring" where step 1 will need to take place again to request a new fresh token.
My question is: Does it make sense to integrate such a external websocket into my tRPC client? Is it even possible?
I read the docs put I can't quite put everything together. I know there is a way to make the url a function, but it does not have any params that can be passed? Same goes for the connectionParams?
The only other way I could think of is to make a custom client hook / context provider which takes in the websocket url and authorization, but I would like to integrate it with my existing tRPC client (via splitLink) 🙏
2 replies
TTCTheo's Typesafe Cult
•Created by Janic on 3/6/2024 in #questions
Auth.js (v5) with Docker?
Did anyone successfully implement the latest Auth.js version in production with Docker?
I have tried to upgrade to the beta version with the Drizzle Adapter, but when using any provider to sign in it basically redirects to the Docker internal host which is
0.0.0.0.
I don't know if this is some kind of issue with Auth.js itself or Next.JS.
So basically setting the NEXTAUTH_URL
and/or AUTH_URL
environment variable to the production url at least sets the correct redirect url on the provider page, but after a successful sign in you still get redirected to 0.0.0.0
.
Maybe I am missing some kind of variable? I found this related discussion on GH, but without any real solution: https://github.com/nextauthjs/next-auth/discussions/8449
If you have any suggestions or managed to solve this, please let me know 🙏1 replies