webiny-websocket-notifications
यह क्या करती है
यह स्किल आपके AI को तब मार्गदर्शन देती है जब सर्वर को एडमिन उपयोगकर्ता को चल रहे काम के बारे में बताना हो। यह उन डेवलपर्स के लिए है जो Webiny एडमिन में लाइव अपडेट चाहते हैं।
कब इस्तेमाल करें
- ✓जब कोई बैकग्राउंड टास्क उस उपयोगकर्ता को प्रगति दिखाना चाहे जिसने उसे शुरू किया।
- ✓जब सर्वर में बदलाव के बाद एडमिन स्क्रीन अपने-आप रीफ़्रेश होनी चाहिए।
- ✓जब कोई संदेश एडमिन ऐप में नोटिफ़िकेशन के रूप में दिखना चाहिए।
Skill का लिंक
https://github.com/webiny/webiny-js/blob/next/skills/user-skills/api/websocket-notifications/SKILL.mdइसे कॉपी करके अपने AI (Claude, ChatGPT या Cursor) में पेस्ट करें और निर्देशों का पालन करने को कहें।
कैसे इस्तेमाल करें
सबसे आसान तरीका: मैसेज कॉपी करके अपने AI में पेस्ट करें। वह skill पढ़कर निर्देशों का पालन करेगा।
पेस्ट करने के लिए तैयार मैसेज
Claude Code, Codex या Cursor के लिए: प्रोजेक्ट फ़ोल्डर में चलाएँ और skill इंस्टॉल हो जाएगी।
SKILL.md डाउनलोड करें और अपने एजेंट के skills फ़ोल्डर में रखें।
AI से क्या माँगें: उदाहरण
“हर प्रोडक्ट के लिए बल्क डिस्काउंट जॉब पूरा होने पर एडमिन में एक नोटिफ़िकेशन दिखाइए।”
हर हफ़्ते 5 नई skills, 1 मिनट में पढ़ें।
यह कैसे काम करती है
सर्वर पर कोड उस उपयोगकर्ता को संदेश भेजता है जिसने काम शुरू किया, और यह सुनिश्चित करता है कि विफल संदेश असली काम को न तोड़े। एडमिन ऐप में एक handler कार्रवाई के आधार पर संदेश छानता है और प्रतिक्रिया देता है, जैसे नोटिफ़िकेशन दिखाना।
तकनीकी सामग्री (मूल 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 या नया चाहिए।
अगर संदेश भेजना विफल हो जाए तो?
स्किल कहती है कि वेबसॉकेट की विफलता कभी असली काम को विफल नहीं करनी चाहिए, इसलिए त्रुटियाँ लॉग होती हैं और अनदेखी की जाती हैं।
संदेश कौन पाता है?
वह उपयोगकर्ता जिसने काम शुरू किया, जिसे identity context से पहचाना जाता है।
जानकारी
लेखक का मूल विवरण
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
- लाइसेंस
- —
- अपडेट की गई
- 2/11/2026
कमेंट
- …
इस repository की और skills
prd-to-plan
8.1kयह आपके एजेंट को प्रोडक्ट आवश्यकताओं के दस्तावेज़ को छोटे, एंड-टू-एंड स्लाइस की चरणबद्ध योजना में बदलने में मदद करती है, जो Markdown फ़ाइल में सहेजी जाती है।
webiny-admin-architect
8.1kयह आपके एजेंट को Webiny प्लेटफ़ॉर्म के लिए एडमिन स्क्रीन बनाना सिखाती है, उसकी बिज़नेस लॉजिक परतों और presenter पैटर्न का उपयोग करके।
webiny-admin-permissions
8.1kयह आपके एजेंट को Webiny एडमिन स्क्रीन में अनुमति नियंत्रण जोड़ना सिखाती है, जिसमें अपने-आप बनने वाले अनुमति फ़ॉर्म और दिखाने-छिपाने की जाँच शामिल हैं।
webiny-form-model
8.1kयह आपके एजेंट को Webiny में declarative field builder, layouts, validation और शर्त वाले नियमों से फ़ॉर्म बनाना सिखाती है।
मिलती-जुलती skills
api-connector-builder
280kयह आपके एजेंट को मौजूदा pattern के हिसाब से नए API connections बनाने देता है। जब बिना कोई नया तरीका बनाए एक और integration जोड़ना हो, तब इसका इस्तेमाल करें।
api-design
280kयह आपके एजेंट को best practices के हिसाब से REST APIs डिज़ाइन करने में मदद करता है। यह तय करने में काम आता है कि APIs आपस में कैसे बात करें, errors कैसे दिखें, और data को कैसे व्यवस्थित करें।
backend-patterns
280kआपके एजेंट को server-side architecture patterns और database optimization में मदद करता है। server पर चलने वाला code बनाने या review करने के लिए उपयोगी है।