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

여석 실시간 조회 기능을 개발한다. #11

Open
1 of 2 tasks
3Juhwan opened this issue Jan 25, 2025 · 1 comment · Fixed by #19
Open
1 of 2 tasks

여석 실시간 조회 기능을 개발한다. #11

3Juhwan opened this issue Jan 25, 2025 · 1 comment · Fixed by #19
Assignees
Labels
기능 새로운 기능을 개발해요.

Comments

@3Juhwan
Copy link
Member

3Juhwan commented Jan 25, 2025

작업할 내용

여석을 실시간으로 조회하는 기능을 개발합니다.

고려할 사항

  • 실시간 성을 고려하여 Server Sent Event를 사용하기로 했는데요. 추후 Socket 또는 폴링으로 변경할 수 있을 것 같습니다. 그 시점에 되었을 때, 갈아끼우기 쉽도록 구현하면 좋을 것 같습니다. 당장은 꼭 안해도 되는 작업입니다.
  • 몇 개의 데이터를 조회할 것인지에 대한 정책이 분리하는 것이 좋을 것 같습니다. 또한 클라이언트 측에서 몇 개의 데이터를 조회할 것인지 설정할 수 있는 기능도 있으면 좋을 것 같습니다.

Server Sent Event 구현

Server Sent Event로 구현할 경우 로직은 다음과 같습니다.

  1. 클라이언트는 /api/connect API를 호출해서 서버와 연결을 맺는다.
  2. 이후에는 Server Sent Event로 여석 데이터를 받는다.

SSE로 받는 여석 데이터 형식은 다음과 같아요. 예시일 뿐, 변경해도 괜찮습니다.

event: non-major
data: [
	{
		subjectId: 1,
		seat: 1, 
		queryTime: "2025-01-23T15:37:23.1352123", 
	},
	{
		subjectId: 2,
		seat: 1,
		queryTime: "2025-01-23T15:37:23.1352123",
	},
	{
		subjectId: 3,
		seat: 3,
		queryTime: "2025-01-23T15:37:23.1352123",
	},
	{
		subjectId: 4,
		seat: 3,
		queryTime: "2025-01-23T15:37:23.1352123",
	}
]
@3Juhwan 3Juhwan linked a pull request Jan 28, 2025 that will close this issue
@3Juhwan 3Juhwan self-assigned this Jan 29, 2025
@3Juhwan 3Juhwan added the 기능 새로운 기능을 개발해요. label Jan 29, 2025
@boyekim
Copy link
Member

boyekim commented Jan 29, 2025

사용자가 어떤 전공과목을 화면에서 선택하고있는지 어떻게 알고 응답을 줄 것인지 논의하면 좋을 것 같아요
사용자가 전공과목 탭을 옮기면 어떻게 SSE의 응답을 변경할 지 논의해보고싶어요
제가 생각한 것은 현재 사용자 토큰에 따라 SseEmitter를 하나 열잖아요? 그래서 그냥 교양, 컴공전공,소웨전공,전정통 전공을 차례대로 계속 내려주는건 어떤가 싶어요...^^ 저희가 아직 전공 과목 서비스를 여러 개 하지 않잖아요, 우선 빠른 구현이 목표라고 생각해서요! 리팩토링 지점으로 남겨두고 이런 방식으로 구현해보는건 어떨까요? 데이터 양도 방대한 것이 아니라 총 40개 정도 되는 거잖아요? 그래서 이런 제안을 해봅니다

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
기능 새로운 기능을 개발해요.
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants