new Join Room form that requests authcookie

getting stubbed session #1,
with auth module stubbed to accept that session in.
and stubbed method for streaming room state,
but that's enough to start testing room calling api's for other actions

next - pass in observable from parent to re-toggle subscription
websocket after successful login
This commit is contained in:
efim
2023-04-26 11:42:40 +04:00
parent 1f28a03d47
commit 90e886c62d
6 changed files with 132 additions and 10 deletions

View File

@@ -62,7 +62,8 @@ object Auth {
roomService.joinRoom(roomId, nickName, nickPassword, roomPassword)
)
.leftMap(_.toString())
newSessionId = Random.nextLong()
// newSessionId = Random.nextLong() // TODO return after i stop mocking RoomService
newSessionId = TestModels.testSessionId
_ <- EitherT.liftF(sessions.update(_.updated(newSessionId, (roomId, playerId))))
} yield ResponseCookie(
name = authcookieName,

View File

@@ -24,10 +24,12 @@ object MyHttpService {
AuthedRoutes.of {
case GET -> Root / "subscribe" as (playerId, roomId) => {
val send: Stream[IO, WebSocketFrame] =
Stream
.emits(TestModels.testChangesList)
.covary[IO]
.metered(1.second)
(
Stream
.emits(TestModels.testChangesList)
.covary[IO]
.metered(1.second) ++ Stream.never[IO]
)
.map(state => WebSocketFrame.Text(state.asJson.noSpaces))
val receive: Pipe[IO, WebSocketFrame, Unit] = _.evalMap {