generated at
ScrapboxがWebSocketで通信しているobjectの一覧
ts
interface SocketIORequest<MethodName extends string, T> { event: "socket.io-request"; data: { method: MethodName; data: T; }; }

ページの移動
要求
ts
interface JoinRoomRequest extends SocketIORequest< "room:join", { pageId: string | null; projectId: string; projectUpdatesStream: false; } | { pageId: null; projectId: string; projectUpdatesStream: true; } > {};
トップページとstreamへのアクセスは pageId: null となる
応答
ts
interface JoinRoomResponse { data: { success: true; pageId: string | null; projectId: string; }; }
Streamの通知
ts
interface ProjectUpdatesStreamCommit { event: "projectUpdatesStream:commit", data: { kind: "page"; id: string; parentId: string; projectId: string; pageId: string; userId: string; changes: (Change[] | [Delete]); cursor: null; freeze: true; }; }
typescript
interface ProjectUpdatesStreamEvent { event: "projectUpdatesStream:event", data: { id: string; pageId: string; userId: string; projectId: string; created: number; updated: number; } & ({ type: "member.join" | "invitation.reset"; } | { type: "page.delete"; data: { titleLc: string; }; } | { type: "admin.add" | "admin.delete" | "owner.set"; targetUserId: string; }); }
ページ
同期情報
ページの更新
ts
interface CommitResponse { event: "commit"; data: { kind: "page"; id: string; parentId: string; projectId: string; pageId: string; userId: string; changes: (Change[] | [Pin] | [Delete]); cursor: null; freeze: true; }; }
カーソルの移動
ts
interface MoveCursor { event: "cursor"; data: { user: { id: string; displayName: string; }; pageId: string; position: { line: number; char: number; }; visible: boolean; socketId?: string; // 応答にのみ存在 }; }
ページの編集
要求
ts
interface CommitRequest extends SocketIORequest< "commit", { kind: "page"; parentId: string; projectId: string; pageId: string; userId: string; changes: (Change[] | [Pin] | [Delete]); cursor: null; freeze: true; } > {}; interface Pin { pin: number; } interface Delete { delete: true; }
応答
ts
interface PageUpdateResponse { data: { commitId: string; } }
commitが整合しない時
ts
interface PageUpdateResponse { data: { commitId: string; }; error: { name: "NotFastForwardError"; message: "Not fast-forward"; }; }
リンク情報の更新
ts
interface QuickSearchCommit { event: "quick-search:commit", data: { kind: "page", id: string; parentId?: string; projectId: string; pageId: string; userId: string; changes: ({ links: string[]; } | { title: string; })[]; cursor: null; freeze: true; }; }
ts
interface QuickSearchReplaceLink { event: "quick-search:replace-link", data: { from: string; to: string; }; }
サムネイル画像の更新
{ image: "https://..."} を送る
Gyazoの場合は { image: "https://gyazo.com/:gyazoid/raw" } になる
サムネイル画像がなくなったときは { image: null } を送る


#2022-02-11 16:45:52
#2021-10-25 10:00:58