Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/son-b/node.js-chat-file
주하히님 블로그 참고하며 실시간 채팅 & 파일전송 스터디
https://github.com/son-b/node.js-chat-file
aws-sdk multer multer-s3 socket-io
Last synced: about 2 months ago
JSON representation
주하히님 블로그 참고하며 실시간 채팅 & 파일전송 스터디
- Host: GitHub
- URL: https://github.com/son-b/node.js-chat-file
- Owner: SoN-B
- Created: 2022-10-10T13:59:19.000Z (over 2 years ago)
- Default Branch: master
- Last Pushed: 2022-10-11T15:31:06.000Z (over 2 years ago)
- Last Synced: 2024-11-10T04:30:13.831Z (3 months ago)
- Topics: aws-sdk, multer, multer-s3, socket-io
- Language: HTML
- Homepage:
- Size: 384 KB
- Stars: 3
- Watchers: 1
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
# nodejs-chatting
[출처 - 설명 포스팅1 ](https://juhi.tistory.com/8)
[출처 - 설명 포스팅2 ](https://juhi.tistory.com/9)
---
## Project Introduce
Node.js의 socket.io모듈을 이용하여 채팅 기능을 구현함
- 채팅방 생성
- 그룹, 일대일 채팅 기능
- 사진 전송

## Code Description
[기본]
1. 클라이언트 : join에 방이름과 함께 socket.emit()
2. 서버 : io.sockets.on연결 & 클라이언트 해당 방에 socket.on(join, ) & socket.join(방이름)
3. 클라이언트 : #name.val()에 닉네임 작성후 /#chatpage로 넘어감 (그값은 계속 저장돼 있음)[메세지 전송]
1. 클라이언트 : #button.click()시 name, message, date값 서버로 socket.emit(message)
2. 서버 : socket.on(message)로 받고, 해당 방이름에(roomName)에 재전달
3. 클라이언트 : socket.on(message)로 받고, 해당 값들 html에 재구성(추가)[사진 전송]
1. 클라이언트 : #uploadbtn.on('click', ~)시 uploadFile()함수(해당API로 POST요청) 실행
2. 서버 : image받고 s3에 업로드 및 해당 객체주소 클라이언트에 리턴
3. 클라이언트 : 성공했을때, name, message(s3 객체 주소), date 뿌려줌## Dependency Module
```
"dependencies": {
"aws-sdk": "^2.1230.0",
"express": "^4.18.1",
"multer": "^1.4.5-lts.1",
"multer-s3": "^2.10.0",
"mysql2": "^2.3.3",
"sequelize": "^6.24.0",
"socket.io": "^4.5.2"
},
```