Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

復帰できるようにする #144

Open
ras0q opened this issue Dec 13, 2021 · 3 comments
Open

復帰できるようにする #144

ras0q opened this issue Dec 13, 2021 · 3 comments
Labels
enhancement New feature or request

Comments

@ras0q
Copy link
Member

ras0q commented Dec 13, 2021

リロードした時にユーザー消えるの不便そう、復帰もできないし

↓一緒にuserIdも保存してもらってセッションごとに同じuserId使うのどうですか、セッション使うとややデバッグめんどくさくなりそうだけど
cat-crosswalk/nascalay-frontend#85

@trasta298
Copy link
Member

セッションはいらなくて,userId->roomを持つ配列を作っておけば復帰するようにできそう (今のままだと全探索になる)

@ras0q
Copy link
Member Author

ras0q commented Dec 13, 2021

それならすでにこれがあるのでエンドポイント増やせばいいかな

func (r *storeRepository) GetRoomFromUserId(uid model.UserId) (*model.Room, error) {
	rid, ok := r.userIdToRoomId[uid]
	if !ok {
		return nil, repository.ErrNotFound
	}

	room, ok := r.room[rid]
	if !ok {
		return nil, repository.ErrNotFound
	}

	return room, nil
}

@trasta298
Copy link
Member

増やすかフロントにuserIdが残っていたときに /ws 叩いてもらうかかな

@ras0q ras0q changed the title セッションを使う 復帰できるようにする Dec 13, 2021
@ras0q ras0q added the enhancement New feature or request label Dec 13, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

2 participants