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

Laravel-echo-server events listeners custom callbacks #589

@Vytautas-RA

Description

@Vytautas-RA

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); 
    }

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions