GeniusesOfSymfony / WebSocketBundle

:part_alternation_mark: Websocket server for Symfony applications (powered by Ratchet), includes a Autobahn.JS based JavaScript client
MIT License
609 stars 140 forks source link

[SOLVED] (Another) How send push to specific user #376

Closed thehatami closed 4 years ago

thehatami commented 5 years ago

according to document, i get user with name and default broadcast work for notify user with {ID} left. until here all things work good.

but when i try call push from controller, get error.

my controller has bind $pusher with @gos_web_socket.amqp.pusher

$pusher->push(['my_data' => 'data'], 'chat_topic',
            array(
                'username' => $username
            )
        );

my pubsub router

chat_topic:
  channel: chat/uio/{username}
  handler:
    callback: 'chat.topic_service'
  requirements:
    username:
      pattern: '[a-zA-Z]+'

and my service

chat.topic_service:
    class: App\Topic\ChatTopic
    arguments: ["@gos_web_socket.websocket.client_manipulator"]
    tags:
      - { name: gos_web_socket.topic }

but i got these error:

Library error: connection closed unexpectedly - Potential login failure.
thehatami commented 5 years ago

i think somethig not work properly. when ig got connection to my rabbitmq i get this msg from gos server run

Attempted to load class "Consumer" from namespace "Gos\Component\ReactAMQP".                      
  Did you forget a "use" statement for e.g. "Predis\PubSub\Consumer" or "Predis\Monitor\Consumer"?

whats my wrong?

thehatami commented 5 years ago

ok. i solved. for first comment: socket must in 5762 not 15672. (15672 for web managment). Also change Topic for sending. for second comment i downgrade 2.x-dev to stable version and install RactAMQP.

mbabker commented 5 years ago

FWIW I know the 2.x (master) branch works for websocket stuff (including the websocket pusher) as I'm running it in production for one of my company clients, but we aren't using AMQP or ZMQ and getting things set up to test those pushers has taken a bit of time, so I can't vouch for how well those two systems work at the moment but it's on my list of things to tackle soon-ish.