Skip to content

소켓 명세서

Kang Minji edited this page Nov 25, 2021 · 12 revisions

접속

접속 방법

io(${url}/team-${teamId});

팀 namespace: /team-teamId(숫자)

change status to online

Emit (Client → Server)

{
	teamId: number;
	userId: number;
}

팀 내부 관리

enter users room

Emit (Client → Server)

users room 참가

leave users room

Emit (Client → Server)

users room 나가기

online users

Emit (Server→ Client)

{
	onlineUsers: { userId: number }[];
}

팀 채팅

room이름: chat-{chatId}

enter chat rooms

Emit (Client → Server)

{
	chatRooms: { chatRoomId: number }[]
}

채팅방(chat-room) 참가 요청

leave chat room

Emit (Client → Server)

{
	chatRooms: { chatRoomId: number }[];
}

채팅방(chat-chatId) 나가기 요청

get message list

Emit (Client → Server)

{
	chatRoomId: number;
}

초기 메시지 리스트 요청

receive message list

Emit (Server → Client)

{
	chatRoomId: number;
	messageList: 
	[ 
		{ 
			messageId: number;
			content: string;
			createdAt: Date;
			userId: number;
			chatRoomId: number;
		},
		{ 
			messageId: number;
			content: string;
			createdAt: Date;
			userId: number;
			chatRoomId: number;
		}
	]
}

메세지 리스트 응답

receive last messages

Emit (Server → Client)

{
	chatRoomId:
		{ 
			messageId: number;
			content: string;
			createdAt: Date;
			userId: number;
			chatRoomId: number;
		},
	chatRoomId:
		{ 
			messageId: number;
			content: string;
			createdAt: Date;
			userId: number;
			chatRoomId: number;
		},
}

최근 메시지 가져오기

send message

Emit (Client → Server)

{
	content: string;
	userId: number;
	chatRoomId: number;
}

메시지 전송

receive message

Emit (Server → Client)

in chat-id room

{
	messageId: number;
	content: string;
	userId: number;
	createdAt: Date;
	chatRoomId: number;
}

메시지 수신

create chat room

Emit (Client→ Server)

{
	chatRoomId: number;
	userList: { userId: number }[]
	teamId: number;
}

채팅방 생성 알림

exit chat room

Emit (Client → Server)

{
	chatRoomId: number;
}

채팅방 나가기 알림

update chat room name

Emit (Client → Server)

{
	chatRoomId: number;
}

채팅방 이름 변경 알림

invite users

Emit (Client→ Server)

{
	chatRoomId: number;
	userList: { userId: number }[];
	teamId: number;
}

유저 초대 알림

refresh chat rooms

Emit (Server → Client)

refresh chat room users

Emit (Server → Client)

팀 보드

Clone this wiki locally