-
Notifications
You must be signed in to change notification settings - Fork 0
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Fe,be/feature/#567 fe,be 소켓 이벤트 타입 공유하기 #571
The head ref may contain hidden characters: "FE,BE/feature/#567-FE,BE-\uC18C\uCF13-\uC774\uBCA4\uD2B8-\uD0C0\uC785-\uACF5\uC720\uD558\uAE30"
Changes from all commits
96b425f
1f64dc0
0abec7f
db88cb2
a8a170c
b7a7280
249f8b0
6416926
2e31d28
e0f1b48
d933414
b976289
6d9338b
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,48 @@ | ||
interface AiSocketEvent { | ||
ServerToClientEvent: { | ||
streamStart: () => void; | ||
streaming: (token: string) => void; | ||
streamEnd: () => void; | ||
tarotCard: () => void; // 타로 카드 펼치기 요청 | ||
chatEnd: (resultId: string) => void; | ||
error: (message: string) => void; | ||
}; | ||
ClientToServerEvent: { | ||
message: (message: string) => void; | ||
tarotRead: (cardIdx: number) => void; // 타로 카드 해설 요청 | ||
}; | ||
InterServerEvents: {}; | ||
SocketData: {}; | ||
} | ||
|
||
interface HumanSocketEvent { | ||
ServerToClientEvent: { | ||
connection: (data: { | ||
description?: RTCSessionDescription | null; | ||
candidate?: RTCIceCandidate | null; | ||
}) => void; | ||
welcome: (otherUsers: any) => void; | ||
userExit: (data: { id: string }) => void; | ||
hostExit: () => void; | ||
roomCreated: () => void; | ||
roomNameGenerated: (roomId: string) => void; | ||
joinRoomFailed: () => void; | ||
joinRoomSuccess: (roomId: string) => void; | ||
roomExist: () => void; | ||
roomNotExist: () => void; | ||
roomFull: () => void; | ||
}; | ||
ClientToServerEvent: { | ||
connection: (data: { | ||
description?: RTCSessionDescription | null; | ||
candidate?: RTCIceCandidate | null; | ||
roomName: string; | ||
}) => void; | ||
generateRoomName: () => void; | ||
createRoom: (roomId: string, password: string) => void; | ||
joinRoom: (roomId: string, password: string) => void; | ||
checkRoomExist: (roomName: string) => void; | ||
}; | ||
InterServerEvents: {}; | ||
SocketData: {}; | ||
} |
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,17 @@ | ||
import { Server, Socket } from 'socket.io'; | ||
|
||
export type HumanServer = Server< | ||
HumanSocketEvent['ClientToServerEvent'], | ||
HumanSocketEvent['ServerToClientEvent'] | ||
>; | ||
|
||
export type HumanSocket = Socket< | ||
HumanSocketEvent['ClientToServerEvent'], | ||
HumanSocketEvent['ServerToClientEvent'] | ||
>; | ||
|
||
export type HumanSocketClientEvent = | ||
keyof HumanSocketEvent['ClientToServerEvent']; | ||
|
||
export type HumanSocketClientEventParams<T extends HumanSocketClientEvent> = | ||
Parameters<HumanSocketEvent['ClientToServerEvent'][T]>; |
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,12 +1,27 @@ | ||
import { Socket as originalSocket } from 'socket.io'; | ||
import { Server, Socket } from 'socket.io'; | ||
import { ChatLog } from './chatbot'; | ||
|
||
export interface UserInfo { | ||
email: string; | ||
providerId: number; | ||
} | ||
export interface Socket extends originalSocket { | ||
|
||
export type AiServer = Server< | ||
AiSocketEvent['ClientToServerEvent'], | ||
AiSocketEvent['ServerToClientEvent'] | ||
>; | ||
|
||
export interface AiSocket | ||
extends Socket< | ||
AiSocketEvent['ClientToServerEvent'], | ||
AiSocketEvent['ServerToClientEvent'] | ||
> { | ||
user?: UserInfo; | ||
chatLog: ChatLog[]; | ||
chatEnd: boolean; | ||
} | ||
|
||
export type AiSocketClientEvent = keyof AiSocketEvent['ClientToServerEvent']; | ||
|
||
export type AiSocketClientEventParams<T extends AiSocketClientEvent> = | ||
Parameters<AiSocketEvent['ClientToServerEvent'][T]>; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
👍👍