socket.io를 활용한 실시간 채팅방 구현 파일 전송 구현
npm install
npm start
method | url | function |
---|---|---|
POST | /user | 새 유저 회원가입 |
POST | /login | 기존 유저 로그인 |
method | url | function |
---|---|---|
POST | /room | 새 채팅방 생성 |
GET | /room:room-name | 채팅방 입장 |
GET | /new-room | 새 채팅방 생성 페이지 입장 |
DELETE | /room:room-name | 채팅방 삭제 (만든 사람만 가능) |
event | param | function |
---|---|---|
connection | socket | 유저 소켓 통신 연결 |
join-room | data{roomId, userId} | 새 유저 채팅방 입장 |
new | data{msg} | 채팅방에 유저 이름 세팅 |
send-msg | roomId, name, msg | 채팅 메시지 보내기 |
receive-msg | text | 채팅 메시지 받기 |
room-broadcast | data{msg} | 전체 안내 메시지 보내기 |
disconnect* |
WebRTC 공식 document : Data Channel
RTCPeerConnection
를 통한 임의의 데이터 전송을 위한 API 지원
RTCDataChannel
객체에서 RTCPeerConnection
객체 반환
const peerConnection = new RTCPeerConnection(configuration);
// createDataChannel()을 호출
const dataChannel = peerConnection.createDataChannel();