webiny-websocket-notifications
하는 일
이 스킬은 서버가 관리자 사용자에게 진행 중인 작업을 알려야 할 때 AI를 안내합니다. Webiny 관리자에서 실시간 업데이트를 원하는 개발자를 위한 스킬입니다.
사용하는 경우
- ✓백그라운드 작업이 시작한 사용자에게 진행 상황을 보여야 할 때.
- ✓서버 변경 후 관리자 화면이 자동으로 새로고침되어야 할 때.
- ✓메시지가 관리자 앱에서 알림으로 보여야 하는 경우.
스킬 링크
https://github.com/webiny/webiny-js/blob/next/skills/user-skills/api/websocket-notifications/SKILL.md복사해서 AI(Claude, ChatGPT, Cursor)에 붙여넣고 지침을 따르도록 요청하세요.
사용 방법
가장 쉬운 방법입니다. 메시지를 복사해 AI에 붙여넣으세요. AI가 스킬을 읽고 지침을 따릅니다.
바로 붙여넣을 수 있는 메시지
Claude Code, Codex, Cursor용입니다. 프로젝트 폴더에서 실행하면 스킬이 설치됩니다.
SKILL.md를 다운로드해 에이전트의 스킬 폴더에 넣으세요.
AI에게 요청하는 예시
“대량 할인 작업이 제품마다 끝나면 관리자에 알림을 보여 주세요.”
매주 새 스킬 5개. 읽는 데 1분.
작동 방식
서버에서는 작업을 시작한 사용자에게 메시지를 보내며, 메시지 전송에 실패해도 실제 작업이 실패하지 않도록 합니다. 관리자 앱에서는 핸들러가 메시지를 동작 유형별로 걸러 알림을 띄우는 등 반응합니다.
기술 내용 (원본 SKILL.md)
작성자의 영어 원문을 GitHub에서 그대로 가져왔습니다.
Websocket notifications (API → Admin)
TL;DR
On the API, inject WebsocketsSendToIdentityUseCase (webiny/api) + IdentityContext
(webiny/api/security) and call sendToIdentity.execute({ id }, { action, data }). On the
Admin, implement a WebsocketEventHandler (webiny/admin/websockets) that filters on
action and reacts (e.g. toast via Notifications from webiny/admin), registered with
createFeature + RegisterFeature.
API — emit
import { WebsocketsSendToIdentityUseCase } from "webiny/api";
import { IdentityContext } from "webiny/api/security";
class MyTaskOrHook {
constructor(
private identityContext: IdentityContext.Interface,
private sendToIdentity: WebsocketsSendToIdentityUseCase.Interface
) {}
async notify(entry) {
// Best-effort: a websocket failure must never fail the real work.
try {
const identity = this.identityContext.getIdentity();
if (identity) {
await this.sendToIdentity.execute(
{ id: identity.id },
{
action: "cms.product.discountApplied",
data: { id: entry.entryId, price: entry.values.price }
}
);
}
} catch (ex) {
// log & swallow
}
}
}
// dependencies: [IdentityContext, WebsocketsSendToIdentityUseCase]
- Send to the user who triggered the work — get them from
IdentityContext. In a background task/bulk action, the triggering identity is available. - Use a namespaced
actionstring; put the payload indata. - Sender data type:
{ action?: string; data?: T; error?: {...} }.
Admin — listen
import { WebsocketEventHandler } from "webiny/admin/websockets";
import { Notifications } from "webiny/admin";
const ACTION = "cms.product.discountApplied";
class MyHandlerImpl implements WebsocketEventHandler.Interface {
constructor(private notifications: Notifications.Interface) {}
async handle(event: WebsocketEventHandler.Event): Promise<void> {
const payload = event.payload as { action?: string; data?: { id: string; price: number } };
if (payload.action !== ACTION || !payload.data) {
return; // every handler sees every message — filter by action
}
this.notifications.success({
title: "Discount applied",
description: `New price ${payload.data.price}.`
});
}
}
export const MyHandler = WebsocketEventHandler.createImplementation({
implementation: MyHandlerImpl,
dependencies: [Notifications]
});
Read the message off event.payload — event.payload.action and event.payload.data
(the exact { action, data } object the API sent).
Admin — register
Register the handler in a feature and render it from your Admin.Extension:
import { createFeature, RegisterFeature } from "webiny/admin";
import { MyHandler } from "./MyHandler.js";
const MyFeature = createFeature({
name: "MyExtension/Notifications",
register(container) {
container.register(MyHandler);
}
});
export default () => <RegisterFeature feature={MyFeature} />;
The websockets runner resolves every registered WebsocketEventHandler and calls handle
for each incoming message — hence the action filter in each handler.
Related
webiny-cms-bulk-actions— the typical emitter: a bulk action'sprocessDatasends a message per processed entry so the Admin can toast progress live.
자주 묻는 질문
어떤 Webiny 버전이 필요한가요?
웹소켓 알림은 Webiny 6.5.0 이상이 필요하다고 스킬이 설명합니다.
메시지 전송이 실패하면 어떻게 되나요?
웹소켓 실패는 실제 작업을 실패시키지 않으므로, 오류를 기록하고 무시한다고 스킬이 설명합니다.
누가 메시지를 받나요?
작업을 시작한 사용자이며, 신원 컨텍스트를 통해 찾습니다.
상세 정보
작성자의 원본 설명
Sending real-time notifications from the API to the Admin app over websockets, and reacting to them on the client. Use this skill when the developer wants to push a message to the user who triggered some server-side work (e.g. per-entry progress from a background task/bulk action) and show a toast, update a cache, or refresh UI in response. Requires Webiny 6.5.0 or newer.
repo: webiny/webiny-js
인기도
- GitHub 스타
- 8.1k
- 순위
- #12592
- 라이선스
- —
- 업데이트
- 2026. 11. 2.
댓글
- …
이 저장소의 다른 스킬
prd-to-plan
8.1k에이전트가 제품 요구사항 문서를 작고 끝까지 이어지는 조각들로 된 단계별 계획으로 바꿔 Markdown 파일로 저장하도록 돕습니다.
webiny-admin-architect
8.1k에이전트에게 Webiny 플랫폼의 관리자 화면을 비즈니스 로직 계층과 프레젠터 패턴으로 만드는 방법을 가르칩니다.
webiny-admin-permissions
8.1k에이전트에게 Webiny 관리자 화면에 권한 제어를 추가하는 법을 가르칩니다. 스키마에서 권한 양식을 자동 생성하고 표시 여부를 확인합니다.
webiny-form-model
8.1k에이전트에게 선언형 필드 빌더, 레이아웃, 검증, 조건부 규칙으로 Webiny 양식을 만드는 법을 가르칩니다.
비슷한 스킬
api-connector-builder
280k에이전트가 기존 패턴을 따라 새로운 API 연결을 만들도록 합니다. 새로운 방식을 도입하지 않고 연동을 하나 더 추가할 때 씁니다.
api-design
280k에이전트가 모범 사례에 따라 REST API를 설계하도록 돕습니다. API가 통신하는 방식, 오류를 보여 주는 방식, 데이터를 정리하는 방식을 정하는 데 유용합니다.
backend-patterns
280k에이전트가 서버 쪽 아키텍처 패턴과 데이터베이스 최적화를 다루도록 돕습니다. 서버에서 실행되는 코드를 만들거나 검토할 때 유용합니다.