Skip to content
This repository has been archived by the owner on Nov 15, 2023. It is now read-only.

Laravel-echo-server events listeners custom callbacks #589

Open
Vytautas-RA opened this issue Feb 17, 2022 · 0 comments
Open

Laravel-echo-server events listeners custom callbacks #589

Vytautas-RA opened this issue Feb 17, 2022 · 0 comments

Comments

@Vytautas-RA
Copy link

I need to process laravel-echo-server some events like onConnect, onDisconnecting and others.

Would be nice to have possibility to process this events with custom code additionally (for example with javascript). I've found events processing in src/echo-server.ts file.
For example declare in laravel-echo-server.json file with custom functions to process events (process_onConnect, process_onDisconnecting and etc., for example) and import these functions in src/echo-servers.ts file on file with custom functions existense and invoke function in events at the end of processing function.
For example:

onDisconnecting(socket: any): void {
        socket.on('disconnecting', (reason) => {
            Object.keys(socket.rooms).forEach(room => {
                if (room !== socket.id) {
                    this.channel.leave(socket, room, reason);
                }
            });
        });
        
       // statements to invode custom code
        if(!process_onDisconnecting)
               process_onDisconnecting(reason); 
    }
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant