darkmoon_uk
11/18/2024, 1:05 AMauthenticate(JWT_AUTH_NAME) {
  rpc(AUTHENTICATED_API_PATH) {
    val currentCall: ApplicationCall = call
    val principal = currentCall.principal<JWTPrincipal>() // Capture the principal
    rpcConfig {
      serialization {
        json()
      }
    }
    registerService<UserService> { coroutineContext ->
      UserServiceImpl(principal, coroutineContext) // Pass principal into service - note this assumes the Service factory will be invoked for each new user(?)
    }
  }
}S.
11/19/2024, 7:51 AMService of any type should be unique on the server, but RPCServer does not specify the actual retention policy. I'm not sure whether this means only one single implementation or only one single registered service, I would assume the latterS.
11/19/2024, 7:52 AMdarkmoon_uk
11/19/2024, 9:07 AMS.
11/19/2024, 9:09 AMS.
11/19/2024, 9:10 AMS.
11/19/2024, 9:11 AMdarkmoon_uk
11/19/2024, 9:13 AMS.
11/19/2024, 9:14 AMDataFetchingEnvironment  which you can add to your functions to use internally but is basically transient for the actual rpc function signature