GithubHelp home page GithubHelp logo

Comments (11)

happyDemon avatar happyDemon commented on July 20, 2024 1

@kashtanoff Every '.' in an event name gets replaced with a '' by the echo client lib.

so actually the even that's being listened to (prefixed with the dot) is 'ticket\created'.
By default the namespace is added 'App\Events\ticket\created'.

from laravel-echo-server.

tinpont avatar tinpont commented on July 20, 2024 1
    onDisconnect(socket: any, channel: string): void {
        socket.on('disconnect', () => this.leave(socket, channel));

        if (this.options.devMode) {
            Log.info(`[${new Date().toLocaleTimeString()}] - ${socket.id} left channel: ${channel}`);
        }
    }

Left channel notice is for onDisconnect function, not for disconnect function. This line of notice may mislead understand server actions. I think we should put it in actual disconnect function.

from laravel-echo-server.

kashtanoff avatar kashtanoff commented on July 20, 2024

i sent

{
  "channel": "tickets",
  "message": {
    "event":"ticket.created",
    "data": {
       "key": "value"
     }
   }
}

to localhost:6001/broadcast

and get next answer

{
  "message": "ok"
}

but not have any frames in websocket

from laravel-echo-server.

tlaverdure avatar tlaverdure commented on July 20, 2024

If you are using http to broadcast you will need to setup referrers.

from laravel-echo-server.

kashtanoff avatar kashtanoff commented on July 20, 2024

I change config and setup referers before use http broadcast

    "referrers": [
        {
            "host": "*",
            "apiKey": "zjhm1Mhedce5Jjci31t1i9Hi2behml1hiXep5m+Ld524aeqd5LPc8e8s=pnl"
        }
    ],

But I not receive any information on client side. Client side code:

    window.Echo.channel('tickets')
            .listen('ticket.created', function(e){
                console.log(e.order.name);
            });

from laravel-echo-server.

tlaverdure avatar tlaverdure commented on July 20, 2024

Until a new version of laravel echo is released to npm you will need to add a . at the beginning of your event name: .ticket.created

There have been some PRs submitted to allow no namespace but this has not been officially released yet. The above will help for now.
laravel/echo#64

from laravel-echo-server.

kashtanoff avatar kashtanoff commented on July 20, 2024

I try add . at the beginning of my event name. It did not help me.

from laravel-echo-server.

kashtanoff avatar kashtanoff commented on July 20, 2024

Thank you. This solve my problem.

from laravel-echo-server.

tinpont avatar tinpont commented on July 20, 2024

I run into the same issue, I don't why left channel after joined channel.

[1:31:38 PM] - xwuyyLDSOlciVRD8AAAA joined channel: chat-room
[1:31:38 PM] - xwuyyLDSOlciVRD8AAAA left channel: chat-room

@kashtanoff How did you solve this problem?

from laravel-echo-server.

barryvdh avatar barryvdh commented on July 20, 2024

Good call! See #97 for PR

from laravel-echo-server.

tinpont avatar tinpont commented on July 20, 2024

Thanks, @barryvdh !

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.