Skip to content
This repository has been archived by the owner on Jan 10, 2022. It is now read-only.

how to receive message? #10

Closed
zhaosih opened this issue Feb 2, 2015 · 6 comments
Closed

how to receive message? #10

zhaosih opened this issue Feb 2, 2015 · 6 comments
Labels

Comments

@zhaosih
Copy link

zhaosih commented Feb 2, 2015

Just find send method, how can I receive message

@fabiang
Copy link
Owner

fabiang commented Feb 9, 2015

Hallo,

you'll have to register an event to the event manager for input events and wait for it to be triggered.

Something like:

$xmpp->getConnection()->getInputStream()->getEventManager()->attach(…)

The right event should be {http://etherx.jabber.org/streams}message.

@zhaosih
Copy link
Author

zhaosih commented Feb 10, 2015

Got it. Really thanks for you kind explanation.

2015-02-09 12:25 GMT+00:00 Fabian Grutschus notifications@github.com:

Hallo,

you'll have to register an event to the event manager for input events and
wait for it to be triggered.

Something like:

$xmpp->getConnection()->getInputStream()->getEventManager()->attach(…)

The right event should be {http://etherx.jabber.org/streams}message.


Reply to this email directly or view it on GitHub
#10 (comment).

@fabiang
Copy link
Owner

fabiang commented Feb 10, 2015

👍

@anandselva
Copy link

Hi zhaosih,

Did you register the event and get message from another user? Can you please guide me on this? I registered an event but somewhat it is not working as expected(May be I am wrong).

Any examples are appreciated!
Thanks

@skobkin
Copy link

skobkin commented Nov 4, 2015

@fabiang, I joining to @anandselva.

Can you provide simple example of "echo bot" for us to understand how to process messages?

@bretterer
Copy link

I Really Really Really need to see an example of Echo bot... I don't see anything that works here! @fabiang please help!

$client->getConnection()->getInputStream()->getEventManager()->attach('{http://etherx.jabber.org/streams}message', function() use ($client) {
        // send a message to the above channel
        $message = new Message;
        $message->setMessage('test')
            ->setTo($channel.'@'.$server)
            ->setType(Message::TYPE_GROUPCHAT);
        $client->send($message);

    });

This does not work!

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
Projects
None yet
Development

No branches or pull requests

5 participants