Skip to content

Commit 7f32b82

Browse files
committed
direct add
1 parent c700042 commit 7f32b82

File tree

1 file changed

+7
-2
lines changed

1 file changed

+7
-2
lines changed

Server.py

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -203,7 +203,9 @@ def send_message(message):
203203
"text": text,
204204
"room_id": room_id,
205205
"sender": sender,
206-
"type": "normal"
206+
"type": "normal",
207+
"direct": False, # react에서 dm인지 아닌지 확인할 수 있는 필드
208+
"target" : "self"
207209
}
208210

209211
# front로부터 받은 data에 direct라는 필드가 있고 false 값이라면 브로드캐스팅을 하고
@@ -212,8 +214,11 @@ def send_message(message):
212214
if message["direct"] == False:
213215
emit("chatting", data, broadcast=True, include_self=True, room=room_id)
214216
else:
215-
emit("chatting", data, to=message["dest"])
217+
data["direct"] = True
216218
emit("chatting", data, to=request.sid)
219+
data["target"] = "other"
220+
emit("chatting", data, to=message["dest"])
221+
217222
# broadcast to others in the room
218223
# emit("chatting", data, room=room_id)
219224

0 commit comments

Comments
 (0)