onlineoffline
-
Social Media 만들기 - 21) message 기능 만들기 (intersection Observer(infiniteScrolling) , online-offline 정보 가져오기)NODE.JS 2021. 8. 7. 23:42
이제 메세지 페이지를 구성하는 메세지들을 실시간으로 오고가도록 설정하자. 먼저 하나의 메세지 내용을 담는 메세지 모델과, 대화내용의 마지막 파트를 저장하고 있는 conversation모델을 만들것이다. (메세지왼쪽 부분에 가장 최근에 주고받은 메세지들 저장하기 위해서) messagemodel const mongoose = require('mongoose') const messageSchema = new mongoose.Schema({ conversation:{ type:mongoose.Types.ObjectId, ref:'Conversation' }, sender:{ type:mongoose.Types.ObjectId, ref:'User' }, recipient:{ type:mongoose.Types.O..