webiny-websocket-notifications
Qué hace
Esta habilidad guía a tu IA cuando el servidor necesita informar al usuario de administración sobre un trabajo en curso. Es para desarrolladores que quieren actualizaciones en directo en el panel de Webiny.
Cuándo usarla
- ✓Cuando una tarea en segundo plano debe mostrar su progreso al usuario que la inició.
- ✓Cuando la pantalla de administración debe actualizarse sola tras un cambio en el servidor.
- ✓Cuando un mensaje debe aparecer como notificación en la aplicación de administración.
Link de la skill
https://github.com/webiny/webiny-js/blob/next/skills/user-skills/api/websocket-notifications/SKILL.mdCópialo y pégalo en tu IA (Claude, ChatGPT o Cursor) pidiéndole que siga las instrucciones.
Cómo usar
La forma más fácil: copia el mensaje y pégalo en tu IA. Ella lee la skill y sigue las instrucciones.
Mensaje listo para pegar
Para Claude Code, Codex o Cursor: ejecútalo en la carpeta del proyecto y la skill queda instalada.
Descarga el SKILL.md y ponlo en la carpeta de skills de tu agente.
Ejemplo de qué pedirle a la IA
“Muestra una notificación en la administración cuando termine el trabajo de descuento masivo de cada producto.”
5 skills nuevas por semana. 1 minuto de lectura.
Cómo funciona
En el servidor, el código envía un mensaje al usuario que activó el trabajo, sin permitir que un mensaje fallido interrumpa el trabajo real. En la aplicación de administración, un manejador filtra los mensajes por su acción y reacciona, por ejemplo mostrando una notificación.
Contenido técnico (SKILL.md original)
Texto original del autor, en inglés, directo de 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.
Preguntas frecuentes
¿Qué versión de Webiny necesita?
La habilidad indica que las notificaciones por websocket requieren Webiny 6.5.0 o posterior.
¿Qué pasa si el mensaje no se envía?
La habilidad indica que un fallo de websocket nunca debe hacer fallar el trabajo real, así que los errores se registran y se ignoran.
¿Quién recibe el mensaje?
El usuario que activó el trabajo, identificado a través del contexto de identidad.
Detalles
Descripción original del autor
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
Popularidad
- Estrellas en GitHub
- 8,1 mil
- Posición en el ranking
- #12592
- Licencia
- —
- Actualizada
- 2/11/2026
Comentarios
- …
Más skills de este repositorio
prd-to-plan
8,1 milAyuda a tu agente a convertir un documento de requisitos de producto en un plan por fases de pequeñas porciones de extremo a extremo, guardado como archivo Markdown.
webiny-admin-architect
8,1 milEnseña a tu agente a crear pantallas de administración para la plataforma Webiny, usando sus capas de lógica de negocio y el patrón presentador.
webiny-admin-permissions
8,1 milEnseña a tu agente a añadir controles de permisos a las pantallas de administración de Webiny, con formularios de permisos autogenerados y comprobaciones de mostrar u ocultar.
webiny-form-model
8,1 milEnseña a tu agente a construir formularios en Webiny con un constructor de campos declarativo, distribuciones, validación y reglas condicionales.
Skills parecidas
api-connector-builder
280 milHace que tu agente cree nuevas conexiones de API siguiendo el patrón existente. Úsalo para añadir una integración más sin inventar otra forma de hacer las cosas.
api-design
280 milAyuda a tu agente a diseñar APIs REST según las buenas prácticas. Es útil para definir cómo se comunican las APIs, cómo se muestran los errores y cómo organizar los datos.
backend-patterns
280 milAyuda a tu agente con patrones de arquitectura del lado del servidor y optimización de bases de datos. Es útil para crear o revisar código que se ejecuta en el servidor.