GithubHelp home page GithubHelp logo

Comments (3)

liaosankai avatar liaosankai commented on July 20, 2024 3

@haunterpokem

Before feature implement I try modify line 107 in laravel-echo-server/src/channels/channel.ts and npm run compile

/**
 * Join private channel, emit data to presence channels.
 *
 * @param  {object} socket
 * @param  {object} data
 * @return {void}
 */
joinPrivate(socket: any, data: any): void {
    this.private.authenticate(socket, data).then(res => {
        socket.join(data.channel);

        if (this.isPresence(data.channel)) {
            this.presence.join(socket, data.channel, res.channel_data);
        }

        this.onJoin(socket, data.channel);
    }, error => {
        socket.emit('echo:error', data.channel, 'unauthorized');
    });
}

"error" is a reserved event in socket.io (socketio/socket.io#2285) , so I replace with "echo:error". The following are examples of Client:

Echo.join('chat.' + roomId)
    .on('echo:error', (err) => {
        console.log(err);
    })
    .here((users) => {
        //
    })
    .joining((user) => {
        console.log(user.name);
    })
    .leaving((user) => {
        console.log(user.name);
    });

from laravel-echo-server.

haunterpokem avatar haunterpokem commented on July 20, 2024

Thanks @liaosankai, when are you going to send a pull request for this? If you wouldn't mind. Maybe we could put some status code for other types of error that might occur?

from laravel-echo-server.

tlaverdure avatar tlaverdure commented on July 20, 2024

Hey there, this issue was opened a while ago. I'm going to close this issue, if this issue still exists, please open a new issue or open a Pull Request.

from laravel-echo-server.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.