You can now specify custom event handlers for SocketIO.
Usage:
1. In your app's hooks.py add `has_realtime_event_handlers=True` so
Framework can assume your app contains custom handler and import them.
2. Create a file called `/app/realtime/handlers.js` with single module
export a function that will setup handlers using socket.
Here's sample code:
```js
// This is /app_root/realtime/handler.js`
function chat_app_handlers(socket) {
socket.on("hello_chat") {
console.log("hello world!");
}
}
module.exports = chat_app_handlers;
```
3. Restart SocketIO server and see if it worked by sending event from
client. In desk based app you can do
`frappe.realtime.socket.emit("hello_chat")`
Middlewares are not yet possible... will be worked upon __some other day__ [tm]
closes https://github.com/frappe/frappe/issues/21528
|
||
|---|---|---|
| .. | ||
| authenticate.js | ||