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

[#79] 웹 소켓 정상작동 시에 연결 #154

Merged
merged 3 commits into from
Nov 29, 2023

Conversation

mahwin
Copy link
Collaborator

@mahwin mahwin commented Nov 29, 2023

한 일

  • mockWebSocket => 실제 webSocket으로 변경
    • 필요업는 코드 삭제
  • loading component에 - 들어간 프로퍼티 네임 카멜 케이즈로 변경

실제 화면

  • 웹 소켓 끊겼다가 다시 연결 되어도 타이머 정상 작동하는지 체크
  • <React.StrictMode>를 off하고 했습니다.
2023-11-29.4.07.48.mov

Copy link

netlify bot commented Nov 29, 2023

Deploy Preview for algo-with-me ready!

Name Link
🔨 Latest commit 06174c6
🔍 Latest deploy log https://app.netlify.com/sites/algo-with-me/deploys/6566ead799d89700075f2dbb
😎 Deploy Preview https://deploy-preview-154--algo-with-me.netlify.app/
📱 Preview on mobile
Toggle QR Code...

QR Code

Use your smartphone camera to open QR code link.

To edit notification comments on pull requests, go to your Netlify site configuration.

@mahwin mahwin self-assigned this Nov 29, 2023
@mahwin mahwin added the FE fe 개발 label Nov 29, 2023
}, []);
const handlePingMessage = useCallback(
(time: Date) => {
console.log('서버에서 온 시간 websocket 연결 확인 용', time);
Copy link
Collaborator

@dmdmdkdkr dmdmdkdkr Nov 29, 2023

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

console.log 이 부분은 지우지 않고 배포하게 되나요?

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

�if (process.env.NODE_ENV === "production") { // production에서만 사용할 수 없도록
console = window.console || {};
console.log = function no_console() {}; // console log 막기
console.warn = function no_console() {}; // console warning 막기
console.error = function () {}; // console error 막기
}
이렇게하면 배포할 때, log가 안 찍히게 할 수 있네요.
웹소켓 연결을 대회 페이지에서 계속 확인해야 개발하기 편할 것 같아서 남겨두긴 했습니다.

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

오오 신기하네요, 감사합니다!

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

� 왜 자꾸 이런게 생길까요 � <- ???

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

그러게요 마크다운에서 깨지는 문자가 있나봐요:

const min = 120;
endsAt = new Date(new Date().getTime() + min * 60 * 1000);

const { remainMiliSeconds, isTimeout } = useSocketTimer({
socket,
endsAt,
socketEvent: 'ping',
pingTime: 5000,
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

상수화 해주시면 더 좋아용

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

SocketTimer에서 pingTime을 직접 주입하면 범용성이 없는것 같아 SocketTimer를 사용하는 곳에서 넘겨 받도록 했습니다.
현재는 대회 페이지에서 pingTime과 socketEvent를 상수화하고 SocketTimer에서 Props로 전달합니다.

Copy link
Collaborator

@dmdmdkdkr dmdmdkdkr left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🍡

@mahwin mahwin merged commit b3781f8 into fe-dev Nov 29, 2023
4 checks passed
@mahwin mahwin deleted the 79-79-웹-소켓-정상작동-시에-연결 branch November 29, 2023 07:58
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
FE fe 개발
Projects
Status: Done
Development

Successfully merging this pull request may close these issues.

3 participants