Skip to content

소켓 명세서

Kang Minji edited this page Dec 2, 2021 · 12 revisions

접속

접속 방법

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

팀 namespace: /team-teamId(숫자)

change status to online

Emit (Client → Server)

{
	teamId: number;
	userId: number;
}

팀 내부 관리

enter users page

Emit (Client → Server)

users room 참가

leave users page

Emit (Client → Server)

users room 나가기

online users

Emit (Server→ Client)

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

팀 채팅

room이름: chat-{chatId}

enter chat page

Emit (Client → Server)

{
	teamId: number;
	userId: number;
}

채팅방 페이지에 들어옴

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

send chat rooms

Emit (Server→ Client )

{
	chatRooms: 
		{ 
			chatRoomId: number;
			chatRoomName: string;
			lastMessage: 
				{ 
					messageId: number;
					content: string;
					createdAt: Date;
					userId: number;
					chatRoomId: number;
				}
		}[];
}

enter chat room

Emit (Client → Server)

{
	chatRoomId: number;
}

초기 메시지 리스트, 유저 정보 요청

receive chat room info

Emit (Server → Client)

{
	chatRoomId: number;
	userList: { userId: number }[]
	messageList: 
		{ 
			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)

{
	teamId: number;
	chatRoomName: string;
	userList: { userId: number }[];
	message: 
		{
			content: string;
			userId: number;
			chatRoomId: number;
		}
}

채팅방 생성

invite users

Emit (Client→ Server)

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

유저 방에 초대

invited to chat room

Emit (Server → Client)

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

채팅방에 초대 받음

join chat room

Emit (Server → Client)

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

다른 사용자가 참여함

exit chat room

Emit (Client → Server)

{
	chatRoomId: number;
	userId: number;
}

채팅방 나가기

left chat room

Emit (Server → Client)

{
	chatRoomId: number;
	userId: number
}

다른 사용자가 떠남

update chat room name

Emit (Client → Server)

{
	chatRoomId: number;
	chatRoomName: string;
}

채팅방 이름 변경 요청

updated chat room name

Emit (Server→ Client)

{
	chatRoomId: number;
	chatRoomName: string;
}

채팅방 이름 변경 응답

chat error

Emit (Server→ Client)

error message

팀 보드

join board page

Emit (Client → Server)

보드 페이지 접속

Emit (Server→ Client)

{
	id: number;
	title: string;
	content: string;
	x: number;
	y: number;
	color: number;
	updatedAt: Date;
	updatedBy: number;
	createdAt: Date;
	createdBy: number;
	whoIsDragging: number;
	whoIsUpdating: number;
}[]

포스트잇 리스트 전송

leave board page

Emit (Client → Server)

보드 페이지 나감

create new postit

Emit (Client → Server)

{
	title: string;
	content: string;
	x: number;
	y: number;
	color: number;
	createdBy: number;
}

새로운 포스트잇 생성

Emit (Server→ Client)

{
	id: number;
	title: string;
	content: string;
	x: number;
	y: number;
	color: number;
	updatedAt: Date;
	updatedBy: number;
	createdAt: Date;
	createdBy: number;
	whoIsDragging: number;
	whoIsUpdating: number;
}

update start postit

Emit (Client → Server)

{
	id: number;
	title: string;
	content: string;
	x: number;
	y: number;
	color: number;
	updatedAt: Date;
	updatedBy: number;
	createdAt: Date;
	createdBy: number;
	whoIsDragging: number;
	whoIsUpdating: number;
}

Emit (Server→ Client)

{
	id: number;
	title: string;
	content: string;
	x: number;
	y: number;
	color: number;
	updatedAt: Date;
	updatedBy: number;
	createdAt: Date;
	createdBy: number;
	whoIsDragging: number;
	whoIsUpdating: number;
}

update end postit

Emit (Client → Server)

{
	id: number;
	title: string;
	content: string;
	x: number;
	y: number;
	color: number;
	updatedAt: Date;
	updatedBy: number;
	createdAt: Date;
	createdBy: number;
	whoIsDragging: number;
	whoIsUpdating: number;
}

Emit (Server→ Client)

{
	id: number;
	title: string;
	content: string;
	x: number;
	y: number;
	color: number;
	updatedAt: Date;
	updatedBy: number;
	createdAt: Date;
	createdBy: number;
	whoIsDragging: number;
	whoIsUpdating: number;
}

drag postit

Emit (Client → Server)

{
	id: number;
	title: string;
	content: string;
	x: number;
	y: number;
	color: number;
	updatedAt: Date;
	updatedBy: number;
	createdAt: Date;
	createdBy: number;
	whoIsDragging: number;
	whoIsUpdating: number;
}

Emit (Server→ Client)

{
	id: number;
	title: string;
	content: string;
	x: number;
	y: number;
	color: number;
	updatedAt: Date;
	updatedBy: number;
	createdAt: Date;
	createdBy: number;
	whoIsDragging: number;
	whoIsUpdating: number;
}

drag end postit

Emit (Client → Server)

{
	id: number;
	title: string;
	content: string;
	x: number;
	y: number;
	color: number;
	updatedAt: Date;
	updatedBy: number;
	createdAt: Date;
	createdBy: number;
	whoIsDragging: number;
	whoIsUpdating: number;
}

Emit (Server→ Client)

{
	id: number;
	title: string;
	content: string;
	x: number;
	y: number;
	color: number;
	updatedAt: Date;
	updatedBy: number;
	createdAt: Date;
	createdBy: number;
	whoIsDragging: number;
	whoIsUpdating: number;
}

delete postit

Emit (Client → Server)

{
	postitId: number;
}

Emit (Server→ Client)

{
	id: number;
	title: string;
	content: string;
	x: number;
	y: number;
	color: number;
	updatedAt: Date;
	updatedBy: number;
	createdAt: Date;
	createdBy: number;
	whoIsDragging: number;
	whoIsUpdating: number;
}

team board error

Emit (Server→ Client)

error message
Clone this wiki locally