shinyubin182485
@shinyubin182485
Reviews Written
-
Average Rating
-
Posts
Q&A
Spring Boot ์ต์ ๋ฒ์ (3.1.5)์ ๋ํ์ฌ..
์ฌ๋ํฉ๋๋ค
- 15
- 5
- 3.1K
Q&A
socket.io ์ฌ์ฉ ์ cors ์๋ฌ with react
ํจ๊ป ์ฐพ์๋ด์ฃผ์ ์ ๊ฐ์ฌํฉ๋๋ค ์ ๋ก์ด๋ ๐์์ฝ๊ฒ๋ ์ ์ญ๋์ด ๋ถ์กฑํด์์ธ์ง ์ฌ๋ฌ๋ฒ ๋ค๋ฅธ ๋ฐฉ์์ ์ ์ฉํด๋ด๋ cors ์ค๋ฅ๊ฐ ๊ณ์ ์ง์๋์ด, ํ๋ก ํธ ํ์์ ๋ก์ปฌ์ nest.js + ๋์ปค ํ๊ฒฝ์ ์ค์ ํด์ฃผ๊ณ ๊ฐ๋ฐํ๊ฒฝ ๊ตฌ์ฑํ๊ฒ๋ ์งํํ์ต๋๋คใ ใ ์ต์ข ๋ฐฐํฌ ์์๋ ํ๋ก ํธ์ ๋ฐฑ์๋ ๋๋ฉ์ธ์ด ๊ฐ๊ธฐ์ ๋ฌธ์ ์๋ ๊ฒ ํ์ธํ์์ต๋๋ค.ํน์ ํ์ ์์๋ Localhost ๋ก ๊ฐ๋ฐ ์ cors ์๋ฌ๊ฐ ์ผ์ด๋๋ฉด ์ด๋ค ๋ฐฉ์์ผ๋ก ์ฒ๋ฆฌํ๋์ง ์๋ ค์ฃผ์ค์ ์์๊น์?
- 0
- 2
- 2.7K
Q&A
socket.io ์ฌ์ฉ์ ๋๋คํ๊ฒ ๊ฐ์ฒด๊ฐ emit ๋ฉ๋๋ค.
์ ๋ง ๊ฐ์ฌํฉ๋๋ค ํด๊ฒฐ๋์์ต๋๋ค!!(์ฌ์ง)
- 0
- 3
- 660
Q&A
socket.io ์ฌ์ฉ์ ๋๋คํ๊ฒ ๊ฐ์ฒด๊ฐ emit ๋ฉ๋๋ค.
์ฐํด์ค์ ๋ต๋ณ์ฃผ์ ์ ๊ฐ์ฌํฉ๋๋ค. ๊ณต์ ์ฃผ์ ๋ฐฉ์์ผ๋ก socket.broadcast.emit() ์งํํด๋ณด์์ผ๋ TypeError: Cannot read properties of undefined (reading 'broadcast') ๋ผ๋ ์๋ฌ๊ฐ ๋ฐ์ํ๋ค์. /** ๋ฉ์์ง ์ ์ก */ sendMessage(message?: any, @ConnectedSocket() socket?: Socket) { console.log(" \n ๐ sendMessage \n", message); // const stringMessage = JSON.stringify(message); // console.log(stringMessage); socket.broadcast.emit("message", message); return Promise.resolve("Message sent successfully"); } ๐ sendMessage { sub: 2, user_email: 'shin.yubin18@gmail.com', iat: 1696039406, exp: 1696043006 } {"sub":2,"user_email":"shin.yubin18@gmail.com","iat":1696039406,"exp":1696043006} /Users/claire/fow/fow-be/src/events/events.gateway.ts:58 socket.broadcast.emit("message", stringMessage); ^ TypeError: Cannot read properties of undefined (reading 'broadcast') at EventsGateway.sendMessage (/Users/claire/fow/fow-be/src/events/events.gateway.ts:58:12) at Timeout._onTimeout (/Users/claire/fow/fow-be/src/events/events.gateway.ts:46:12) at listOnTimeout (node:internal/timers:569:17) at processTimers (node:internal/timers:512:7)(์ฌ์ง) socket.io์ ๋ฒ์ ๋ฌธ์ ์ธ๊ฐ ์ถ์ด socket.io@2.0.3 ์ ์ค์นํด๋ณด๋ ํ๊ธฐ ์ค๋ฅ๊ฐ ๋ํ๋ ์ญ์ ํ์์ต๋๋ค.src/auth/strategy/ws.strategy.ts:7:16 - error TS2665: Invalid module name in augmentation. Module 'socket.io' resolves to an untyped module at '/Users/claire/fow/fow-be/node_modules/socket.io/lib/index.js', which cannot be augmented. 7 declare module "socket.io" {https://github.com/socketio/socket.io-redis-adapter/issues/478https://velog.io/@yeonnex/npm-%ED%8C%A8%ED%82%A4%EC%A7%80-%EB%B2%84%EC%A0%84%EC%9D%98-%EC%A4%91%EC%9A%94%EC%84%B1feat.-socket.io%EC%99%80undefined(์ฌ์ง)
- 0
- 3
- 660




