Coder Social home page Coder Social logo

xmpp's Introduction

fabiang/xmpp

Library for XMPP protocol connections (Jabber) for PHP.

License Latest Stable Version Total Downloads Dependency Status Build Status Coverage Status Scrutinizer Quality Score SensioLabsInsight

SYSTEM REQUIREMENTS

  • PHP minimum 5.6 or minimum 7.0
  • psr/log
  • (optional) psr/log-implementation - like monolog/monolog for logging

INSTALLATION

New to Composer? Read the introduction. Add the following to your composer file:

composer require fabiang/xmpp

DOCUMENTATION

This library uses an object to hold options:

use Fabiang\Xmpp\Options;
$options = new Options($address);
$options->setUsername($username)
    ->setPassword($password);

The server address must be in the format tcp://myjabber.com:5222.
If the server supports TLS the connection will automatically be encrypted.

You can also pass a PSR-2-compatible object to the options object:

$options->setLogger($logger)

The client manages the connection to the Jabber server and requires the options object:

use Fabiang\Xmpp\Client;
$client = new Client($options);
// optional connect manually
$client->connect();

For sending data you just need to pass a object that implements Fabiang\Xmpp\Protocol\ProtocolImplementationInterface:

use Fabiang\Xmpp\Protocol\Roster;
use Fabiang\Xmpp\Protocol\Presence;
use Fabiang\Xmpp\Protocol\Message;

// fetch roster list; users and their groups
$client->send(new Roster);
// set status to online
$client->send(new Presence);

// send a message to another user
$message = new Message;
$message->setMessage('test')
    ->setTo('[email protected]')
$client->send($message);

// join a channel
$channel = new Presence;
$channel->setTo('[email protected]')
    ->setPassword('channelpassword')
    ->setNickName('mynick');
$client->send($channel);

// send a message to the above channel
$message = new Message;
$message->setMessage('test')
    ->setTo('[email protected]')
    ->setType(Message::TYPE_GROUPCHAT);
$client->send($message);

After all you should disconnect:

$client->disconnect();

DEVELOPING

If you like this library and you want to contribute, make sure the unit-tests and integration tests are running. Composer will help you to install the right version of PHPUnit and Behat.

composer install

After that:

./vendor/bin/phpunit
./vendor/bin/behat

New features should always tested with Behat.

LICENSE

BSD-2-Clause. See the LICENSE.

TODO

  • Better integration of channels
  • Factory method for server addresses
  • improve documentation

xmpp's People

Contributors

alexalouit avatar antonkomarev avatar fabiang avatar frederikbosch avatar ghitu avatar iivannov avatar marclaporte avatar n10ty avatar pirxthepilot avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

xmpp's Issues

ejabberd_c2s:wait_for_feature_request Error From XMpp while generating new USER id for client chat app

2016-09-05 19:34:51.079 [info] <0.498.0>@ejabberd_http:init:157 started: {gen_tcp,#Port<0.3947>}
2016-09-05 19:35:06.894 [info] <0.491.0>@ejabberd_listener🉑299 (#Port<0.3948>) Accepted connection 103.255.4.61:40738 -> 162.243.172.244:5222
2016-09-05 19:35:07.306 [info] <0.500.0>@ejabberd_c2s:wait_for_feature_request:789 ({socket_state,gen_tcp,#Port<0.3948>,<0.499.0>}) Failed authentication for 57a6697147e6e21b268b456d@server1..com from 193.355.4.61
2016-09-05 19:35:08.225 [info] <0.491.0>@ejabberd_listener🉑299 (#Port<0.3949>) Accepted connection 103.255.4.61:40739 -> 162.243.172.244:5222
2016-09-05 19:35:08.503 [info] <0.502.0>@ejabberd_c2s:wait_for_feature_request:789 ({socket_state,gen_tcp,#Port<0.3949>,<0.501.0>}) Failed authentication for 57a6697147e6e21b268b456d@server1.
.com from 193.355.4.61

Getting this error when XMPP try to create new USER I
https://guides.github.com/features/mastering-markdown/D and authenticate it. NEW CREATED id doesnt store in Ejabberd

Help with receive message.

Hi, Fabian...
Well I read issue #10 and I understands your answer. I need register one function callback in EventManager to stay listening, when receive message, can it process.
But I not got it how make this. You can help us with one example?

I made tests but the registered event, not occur.

since now thank you

group presence and groupchat not working against jabberd2 2.3.1

The jabberd2 in Mac OS X Yosemite is 2.3.1. This module can connect and send messages to other clients, but it can't join a room or send to a room.

Here's an excerpt. Unfortunately it didn't send any errors:

[2015-05-26 19:18:17] jabberlog.DEBUG: Connected to 'tcp://chat.example.com:5222' [] []
[2015-05-26 19:18:17] jabberlog.DEBUG: Sending data '<?xml version="1.0" encoding="UTF-8"?> <stream:stream to="chat.example.com" xmlns:stream="http://etherx.jabber.org/streams" xmlns="jabber:client" version="1.0">' to 'tcp://chat.example.com:5222' [] []
[2015-05-26 19:18:17] jabberlog.DEBUG: Listener "Fabiang\Xmpp\EventListener\Stream\Stream" is currently blocking [] []
[2015-05-26 19:18:17] jabberlog.DEBUG: Received buffer '<?xml version='1.0'?><stream:stream xmlns:stream='http://etherx.jabber.org/streams' xmlns='jabber:client' from='chat.example.com' version='1.0' id='sf7ba0b8shtz2p2ihaey9fm6arhe9kzjrh9ngujy' xmlns:ack='http://www.xmpp.org/extensions/xep-0198.html#ns'>' from 'tcp://chat.example.com:5222' [] []
[2015-05-26 19:18:17] jabberlog.DEBUG: Received buffer '<stream:features xmlns:stream='http://etherx.jabber.org/streams'><starttls xmlns='urn:ietf:params:xml:ns:xmpp-tls'><required/></starttls><address xmlns='http://affinix.com/jabber/address'>::ffff:xx.xxx.xx.x</address><auth xmlns='http://jabber.org/features/iq-auth'/></stream:features>' from 'tcp://chat.example.com:5222' [] []
[2015-05-26 19:18:17] jabberlog.DEBUG: Sending data '<starttls xmlns="urn:ietf:params:xml:ns:xmpp-tls"/>' to 'tcp://chat.example.com:5222' [] []
[2015-05-26 19:18:17] jabberlog.DEBUG: Listener "Fabiang\Xmpp\EventListener\Stream\StartTls" is currently blocking [] []
[2015-05-26 19:18:17] jabberlog.DEBUG: Received buffer '<proceed xmlns='urn:ietf:params:xml:ns:xmpp-tls'/>' from 'tcp://chat.example.com:5222' [] []
[2015-05-26 19:18:17] jabberlog.DEBUG: Sending data '<?xml version="1.0" encoding="UTF-8"?> <stream:stream to="chat.example.com" xmlns:stream="http://etherx.jabber.org/streams" xmlns="jabber:client" version="1.0">' to 'tcp://chat.example.com:5222' [] []
[2015-05-26 19:18:17] jabberlog.DEBUG: Listener "Fabiang\Xmpp\EventListener\Stream\Stream" is currently blocking [] []
[2015-05-26 19:18:17] jabberlog.DEBUG: Received buffer '<?xml version='1.0'?><stream:stream xmlns:stream='http://etherx.jabber.org/streams' xmlns='jabber:client' from='chat.example.com' version='1.0' id='5la773l6hafpyde8jqpzd1zfzm90m3vf8db9gyt7' xmlns:ack='http://www.xmpp.org/extensions/xep-0198.html#ns'>' from 'tcp://chat.example.com:5222' [] []
[2015-05-26 19:18:17] jabberlog.DEBUG: Received buffer '<stream:features xmlns:stream='http://etherx.jabber.org/streams'><address xmlns='http://affinix.com/jabber/address'>::ffff:xx.xxx.xx.x</address><mechanisms xmlns='urn:ietf:params:xml:ns:xmpp-sasl'><mechanism>PLAIN</mechanism></mechanisms><auth xmlns='http://jabber.org/features/iq-auth'/></stream:features>' from 'tcp://chat.example.com:5222' [] []
[2015-05-26 19:18:17] jabberlog.DEBUG: Sending data '<auth xmlns="urn:ietf:params:xml:ns:xmpp-sasl" mechanism="PLAIN">AHNlb2JvdABNZWcwazFsbGVy</auth>' to 'tcp://chat.example.com:5222' [] []
[2015-05-26 19:18:17] jabberlog.DEBUG: Listener "Fabiang\Xmpp\EventListener\Stream\Authentication" is currently blocking [] []
[2015-05-26 19:18:17] jabberlog.DEBUG: Received buffer '<success xmlns='urn:ietf:params:xml:ns:xmpp-sasl'/>' from 'tcp://chat.example.com:5222' [] []
[2015-05-26 19:18:17] jabberlog.DEBUG: Sending data '<?xml version="1.0" encoding="UTF-8"?> <stream:stream to="chat.example.com" xmlns:stream="http://etherx.jabber.org/streams" xmlns="jabber:client" version="1.0">' to 'tcp://chat.example.com:5222' [] []
[2015-05-26 19:18:17] jabberlog.DEBUG: Listener "Fabiang\Xmpp\EventListener\Stream\Stream" is currently blocking [] []
[2015-05-26 19:18:17] jabberlog.DEBUG: Received buffer '<?xml version='1.0'?><stream:stream xmlns:stream='http://etherx.jabber.org/streams' xmlns='jabber:client' from='chat.example.com' version='1.0' id='9bcqah9mss71rxkqs58tvqv3gwt5z8l0g5mk25gh' xmlns:ack='http://www.xmpp.org/extensions/xep-0198.html#ns'>' from 'tcp://chat.example.com:5222' [] []
[2015-05-26 19:18:17] jabberlog.DEBUG: Received buffer '<stream:features xmlns:stream='http://etherx.jabber.org/streams'><ack:ack/><bind xmlns='urn:ietf:params:xml:ns:xmpp-bind'><required/></bind><unbind xmlns='urn:ietf:params:xml:ns:xmpp-bind'/><ver xmlns='urn:xmpp:features:rosterver'/></stream:features>' from 'tcp://chat.example.com:5222' [] []
[2015-05-26 19:18:17] jabberlog.DEBUG: Sending data '<iq type="set" id="fabiang_xmpp_5564c6f9d50fc"><bind xmlns="urn:ietf:params:xml:ns:xmpp-bind"/></iq>' to 'tcp://chat.example.com:5222' [] []
[2015-05-26 19:18:17] jabberlog.DEBUG: Listener "Fabiang\Xmpp\EventListener\Stream\Bind" is currently blocking [] []
[2015-05-26 19:18:17] jabberlog.DEBUG: Received buffer '<iq xmlns='jabber:client' id='fabiang_xmpp_5564c6f9d50fc' type='result'><bind xmlns='urn:ietf:params:xml:ns:xmpp-bind'><jid>[email protected]/0602c847d660707bc2705ed5673d57bdd1875bfd</jid></bind></iq>' from 'tcp://chat.example.com:5222' [] []
[2015-05-26 19:18:17] jabberlog.DEBUG: Sending data '<presence to="[email protected]/[email protected]"><priority>1</priority></presence>' to 'tcp://chat.example.com:5222' [] []
[2015-05-26 19:18:17] jabberlog.DEBUG: Sending data '<message type="chat" id="fabiang_xmpp_5564c6f9d6074" to="[email protected]"><body>[test] admin updated the task #1 (test 16 17 18 24 26 27 29 30)</body></message>' to 'tcp://chat.example.com:5222' [] []
[2015-05-26 19:18:17] jabberlog.DEBUG: Sending data '<message type="groupchat" id="fabiang_xmpp_5564c6f9d617d" to="[email protected]"><body>[test] admin updated the task #1 (test 16 17 18 24 26 27 29 30)</body></message>' to 'tcp://chat.example.com:5222' [] []
[2015-05-26 19:18:17] jabberlog.DEBUG: Sending data '</stream:stream>' to 'tcp://chat.example.com:5222' [] []
[2015-05-26 19:18:17] jabberlog.DEBUG: Disconnected from 'tcp://chat.example.com:5222' [] []

Prosody supports

Hi everyone.
You did a great job. the library is very usefuI.
Please I would like to know if this library works with Prosody IM.

Best Regard

List of Events

Is there a list of supported events? And, maybe examples of how to properly attach a listener?

Thank you!

Stream Error: "host unknown" message

Hi,
We're trying to get the library set up and running correctly with our test server but when we try to connect, we're getting a 'host unknown' message back.

We're using an IP address for the xmpp server address right now (not on the local box) and have a self-signed certificate. I set up the fix for self-signed certs described here: #19 but get the same result. I checked the parsing, etc and it appears that the IP address itself is getting parsed correctly.

I don't have much experience on the xmpp side, so it may be that there's a simple thing I'm overlooking/not seeing here. Any thoughts?

This is my code:

$options = new Options("tcp://12.34.567.89:5222");
$options->setUsername('ausername')
    ->setPassword('1234');

$client = new Client($options);
$client->connect();

UPDATE
It appears the script is just not liking the IP address - I put in a test domain name and it by passed the above error but timed out (no xmpp server installed on the test domain yet). If there's an issue other than this that I may be missing, please let me know.

RESOLVED
Disregard the update above - I found the setTo method in Options, and now have:

$options = new Options("tcp://12.34.567.89:5222");
$options->setUsername('ausername')
    ->setPassword('1234')
    ->setTo('localhost');

and all works. May be worth adding to the example in the wiki for n00bs such as myself.

Need help to make connection stay alive and get message from another user

Hi there!,

I can able to connect server and send message using my connection but the connection closed automatically after sending the message. I didn't disconnect the client but its disconnected automatically.

Also, how can I get message from users(rosters)? Any help is appreciated. Thanks.

Add user to group

Hello. I need to add a user to group programatically. Now I am register a user programatically but the group is "None".

`<?php

namespace Fabiang\Xmpp\Protocol;

use Fabiang\Xmpp\Util\XML;

/**

  • Register new user

  • @param string $username

  • @param string $password

  • @param string $email

  • @Package XMPP\Protocol

  • @category XMPP
    */
    class RegisterUserER implements ProtocolImplementationInterface
    {
    protected $username;
    protected $password;
    protected $email;

    /**

    • Constructor.
    • @param string $username
    • @param string $password
    • @param string $email
      */
      public function __construct($username, $password, $email)
      {
      $this->username = $username;
      $this->password = $password;
      $this->email = $email;
      }

    /**

    • Build XML message
    • @return type
      */
      public function toString()
      {
      $query = "%s%s%s";
      return XML::quoteMessage($query, XML::generateId(), (string) $this->username, (string) $this->password, (string) $this->email);
      }
      }
      `

List of users

Hello again,

Is there a way to retrieve a list of all XMPP users?

Thanks in advance.

StanzasErrorException is not triggered

Hi everyone.
I am using the library for managing my ejabberd user. But https://xmpp.org/extensions/xep-0086.html seems to be deprecated and was rolled into the new [xmpp-core] http://xmpp.org/rfcs/rfc6120.html. Stanza errors are defined in https://xmpp.org/rfcs/rfc6120.html#stanzas-error and https://xmpp.org/rfcs/rfc3920.html#rfc.section.9.3.3.
So when try to register a user throuh fabiang library everything works perferctly. But when I try to register one more time and existing user the StanzasErrorException is not trigger.
Could someone help me ?
I dont know what's wrong with my settings.
Best ragard.

Registration Protocol

Hello,

I've extended the implementation protocol with a class that allows user registration.

<?php

use Fabiang\Xmpp\Util\XML;
use Fabiang\Xmpp\Protocol\ProtocolImplementationInterface;

/**
 * Register new user
 * @param string $username
 * @param string $password
 * @param string $email
 * @package XMPP\Protocol
 * @category XMPP
 */
class XRegister implements ProtocolImplementationInterface
{
    protected $__data = array();
    /**
     * Get all values
     */
    public function getProperties()
    {
        return $this->__data;
    }
    /**
     * Get a value
     * @param type $key
     * @return type
     */
    public function __get($key)
    {
        return isset($this->__data[$key]) ? $this->__data[$key] : NULL;
    }
    /**
     * Set value
     * @param type $key
     * @param type $value
     * @return \XRegister
     */
    public function __set($key, $value)
    {
        $this->__data[$key] = $value;
        return $this;
    }
    /**
     * Build XML message
     * @return type
     */
    public function toString()
    {
        $query = "<iq type='set' id='%s'><query xmlns='jabber:iq:register'><username>%s</username><password>%s</password><email>%s</email></query></iq>";        
        return XML::quoteMessage($query, XML::generateId(), (string) $this->username, (string) $this->password, (string) $this->email);
    }
}

How can i see / parse the server response on the above call?

How can I subscribe to other users?

I have 2 jabber accounts - mine and bot. I am subscribed to bot, but he doesn't subscribe to me, so I receive messages from bot, but can't see it's status (online/offline/connecting and so on).

Bot gets presence from me <presence from='my_jabber' type='subscribe'/>, but doesn't respond to it.

After sending re-authorization request to bot in pidgin debug window I get this
<iq id='lx1620505' type='set'><query ver='34' xmlns='jabber:iq:roster'><item jid='jabber_bot' ask='subscribe' subscription='none'><group>Buddies</group></item></query></iq>

Is there any way to respond to the mine subscription?

How to stable login status?

When i trying to connect user to openfire as per the given example, the user status is not stable don't know why am getting "Logout Less than 1 minute" this message in openfire console.

Can someone please help me in this, am totally new in openfire.
I need to setup web to app chatting, please let me know the possibility.

Thank You in advance.

PHP 5.6: Can't pass the authorization procedure.

During connection applying TLS with the following settings: #19
JID and password are correct, but the user does not pass the authorization procedure:

Stream Error: "not-authorized". 500 Internal Server Error - AuthenticationErrorException

Stream Error: "malformed-request"

I am trying to send message.
Here is xmpp_send_mes.php :

require __DIR__ . '/vendor/autoload.php';

use Fabiang\Xmpp\Options;

$address = 'tcp://[address]:5222';
$username = [username];
$password = [pass];

$options = new Options($address);
$options->setUsername($username)
        ->setPassword($password);

use Fabiang\Xmpp\Client;
$client = new Client($options);
// optional connect manually
$client->connect();

use Fabiang\Xmpp\Protocol\Roster;
use Fabiang\Xmpp\Protocol\Presence;
use Fabiang\Xmpp\Protocol\Message;

// fetch roster list; users and their groups
$client->send(new Roster);
// set status to online
$client->send(new Presence);

// send a message to another user
$message = new Message;
$message->setMessage('test')
        ->setTo('*****');
$client->send($message); 

$client->disconnect();

What I get in terminal :

user@PC:/var/www/site1$ php -f xmpp_send_mes.php
PHP Fatal error:  Uncaught Fabiang\Xmpp\Exception\Stream\AuthenticationErrorException: Stream Error: "malformed-request" in /var/www/site1/vendor/fabiang/xmpp/src/Exception/Stream/StreamErrorException.php:77
Stack trace:
#0 /var/www/site1/vendor/fabiang/xmpp/src/EventListener/Stream/Authentication.php(163): Fabiang\Xmpp\Exception\Stream\StreamErrorException::createFromEvent(Object(Fabiang\Xmpp\Event\XMLEvent))
#1 [internal function]: Fabiang\Xmpp\EventListener\Stream\Authentication->failure(Object(Fabiang\Xmpp\Event\XMLEvent))
#2 /var/www/site1/vendor/fabiang/xmpp/src/Event/EventManager.php(126): call_user_func(Array, Object(Fabiang\Xmpp\Event\XMLEvent))
#3 /var/www/site1/vendor/fabiang/xmpp/src/Stream/XMLStream.php(362): Fabiang\Xmpp\Event\EventManager->trigger('{urn:ietf:param...', Object(Fabiang\Xmpp\Stream\XMLStream), Array)
#4 /var/www/site1/vendor/fabiang/xmpp/src/Stream/XMLStream.php(163): Fabiang\Xmpp\Stream\XMLStream->trigger()
#5 /var/www/site1/vendor/fabiang/xmpp/src/Connection/Socket.php(109): Fabiang\Xmpp\Stream\X in /var/www/site1/vendor/fabiang/xmpp/src/Exception/Stream/StreamErrorException.php on line 77

What do I do wrong?

XML parsing error

Hi.
Recently, such errors have appeared.

Fabiang\Xmpp\Exception\XMLParserException: XML parsing error: "Invalid document end" at Line 2 at column 413 in vendor/fabiang/xmpp/src/Exception/XMLParserException.php:68
Stack trace:
#0 vendor/fabiang/xmpp/src/Stream/XMLStream.php(160): Fabiang\Xmpp\Exception\XMLParserException::create(Resource id #208)
#1 vendor/fabiang/xmpp/src/Connection/Socket.php(162): Fabiang\Xmpp\Stream\XMLStream->parse('</stream:stream...')
#2 vendor/fabiang/xmpp/src/Connection/Socket.php(193): Fabiang\Xmpp\Connection\Socket->send('</stream:stream...')
#3 vendor/fabiang/xmpp/src/Client.php(136): Fabiang\Xmpp\Connection\Socket->disconnect()

Same Client window during same /string

Hello,
I combine this framework with an native chat client(psi)
While sending some messages from php console it opens everytime an new "window-inanstane" in psi
During some comparisons the window based up the "client-string" -> "2158401630142528489031240"

' from 'tcp://my.de:5222

Is it possible to set this client string "[email protected]/user1FromConsole" or other static vars?

So i will get the same window for the same session.

Thx !

Wrongly calling call_user_func with an array in eventmanager

There is an issue with this code in the eventmanager:

public function trigger($event, $caller, array $parameters)
...
$callbacks = array_merge($events, $this->events[self::WILDCARD]);
...
do {
$current = array_shift($callbacks);
call_user_func($current, $eventObject);

$current is usually an array which it shouldn't be (PHP Notice: Array to string conversion in /tmp/src/Event/EventManager.php on line 128)

Pulling Roster fails with a large roster set

When pulling a large roster of users (>250) we are having an issue where the reading of the socket stops and does not error or provide a valid result, which causes the web server to eventually time out sending a message. The timeout appears to happen around or on line 103 of xmpp/src/Connection/Socket.php. When viewing the debug log, we can see it looping multiple times over the packet, and eventually it just stops. If we increase the value in xmpp/src/Connection/Socket.php on line 53 to 8192 from 4096, the issue disappears and we are able to load rosters and send messages again. Obviously, this is not an ideal way to resolve the problem, but after a few hours of debugging, we can't see exactly why this issue is presenting. Please let us know if any further information is assistive to solve this bug.

Thank you

Maintain persistent connection - question

Hi @fabiang,
Is there a possibility to make persistent connection? Currently, when I send message and receive response, it's automatically disconnected. Can I prevent it and keep connection alive?
Thanks!

How to connect to Google Talk

I am trying to connect to Google Talk but am getting a Stream Error: "host-unknown" error. Any idea why? Here is my code:

$Options = new Options('tcp://talk.google.com:5222');
$Options->setUsername('[email protected]');
$Options->setPassword('*********');

$Client = new Client($Options);
$Client->connect();

$roster = $Client->send(new Roster);
$Client->disconnect();

Error occurs on $Client->connect();. I appreciate any help. Thanks!

Extract the origin of a message

Hi there,

I am working on a project with xmpp and I already figured out this line is used to receive a message:
$input = $client->getConnection()->receive();
But I cant figure out how to find the sending adress.
ie:
if [email protected] sends a message I only receive the message and not his adress.

Connecting to prosody

Is there a known problem when connecting to prosody?

I always get a

Uncaught exception 'Fabiang\Xmpp\Exception\Stream\StreamErrorException' with message 'Stream Error: "host-unknown"'

but the host can't be the problem. I can connect to it with pidgin without any problems.

Retrieve message

Hi, is there a way to retrieve messages using this here library?

Ampersand XML unterminated entity reference with &amp;

Hi

I am getting:

lPRODnode1 is reporting *Failed sending item 707990 with error:
Fabiang\Xmpp\Stream\XMLStream::createAttributeNodes(): unterminated entity reference

whenever my xmpp message to send has an & in it. I can see it is being escaped correctly ($message ->toString() shows "&"

Any ideas why I get this error when I try and send the xmpp msg? (fyi this occurs when I send the &amp as an attribute to a custom xml element sent in the xmpp message. Note I am running XML::quote on it as you do in your Message object.

Tx

Incomplete buffer response

Hello,

I've installed a local openfire server with plaintext authorization.

Authorization response is not complete, so the script triggers error.

[2014-11-19 14:07:41] xmpp.DEBUG: Received buffer '<' from 'localhost:5222' [] []
[2014-11-19 14:07:41] xmpp.DEBUG: Received buffer 'success xmlns="urn:ietf:params:xml:ns:xmpp-sasl"/>' from 'localhost:5222' [] []

As you can see above, the buffer is triggered twice for the same response, and this triggers error

XML parsing error: "Not well-formed (invalid token)" at Line 1 at column 1

Adding full stack trace with error.

XML parsing error: "Not well-formed (invalid token)" at Line 1 at column 1
#0 api\vendor\fabiang\xmpp\src\Stream\XMLStream.php(160): Fabiang\Xmpp\Exception\XMLParserException::create(Resource id #317)
#1 api\vendor\fabiang\xmpp\src\Connection\Socket.php(109): Fabiang\Xmpp\Stream\XMLStream->parse('success xmlns="...')
#2 api\vendor\fabiang\xmpp\src\Connection\Socket.php(165): Fabiang\Xmpp\Connection\Socket->receive()
#3 api\vendor\fabiang\xmpp\src\EventListener\Stream\Authentication\Plain.php(66): Fabiang\Xmpp\Connection\Socket->send('<auth xmlns="ur...')
#4 api\vendor\fabiang\xmpp\src\EventListener\Stream\Authentication.php(116): Fabiang\Xmpp\EventListener\Stream\Authentication\Plain->authenticate('admin', 'admin')
#5 [internal function]: Fabiang\Xmpp\EventListener\Stream\Authentication->authenticate(Object(Fabiang\Xmpp\Event\XMLEvent))
#6 api\vendor\fabiang\xmpp\src\Event\EventManager.php(126): call_user_func(Array, Object(Fabiang\Xmpp\Event\XMLEvent))
#7 api\vendor\fabiang\xmpp\src\Stream\XMLStream.php(361): Fabiang\Xmpp\Event\EventManager->trigger('{urn:ietf:param...', Object(Fabiang\Xmpp\Stream\XMLStream), Array)
#8 api\vendor\fabiang\xmpp\src\Stream\XMLStream.php(163): Fabiang\Xmpp\Stream\XMLStream->trigger()
#9 api\vendor\fabiang\xmpp\src\Connection\Socket.php(109): Fabiang\Xmpp\Stream\XMLStream->parse('<?xml version='...')
#10 api\vendor\fabiang\xmpp\src\Connection\Socket.php(165): Fabiang\Xmpp\Connection\Socket->receive()
#11 api\vendor\fabiang\xmpp\src\Connection\Socket.php(183): Fabiang\Xmpp\Connection\Socket->send('<?xml version="...')
#12 api\vendor\fabiang\xmpp\src\EventListener\Stream\StartTls.php(100): Fabiang\Xmpp\Connection\Socket->connect()
#13 [internal function]: Fabiang\Xmpp\EventListener\Stream\StartTls->proceed(Object(Fabiang\Xmpp\Event\XMLEvent))
#14 api\vendor\fabiang\xmpp\src\Event\EventManager.php(126): call_user_func(Array, Object(Fabiang\Xmpp\Event\XMLEvent))
#15 api\vendor\fabiang\xmpp\src\Stream\XMLStream.php(361): Fabiang\Xmpp\Event\EventManager->trigger('{urn:ietf:param...', Object(Fabiang\Xmpp\Stream\XMLStream), Array)
#16 api\vendor\fabiang\xmpp\src\Stream\XMLStream.php(163): Fabiang\Xmpp\Stream\XMLStream->trigger()
#17 api\vendor\fabiang\xmpp\src\Connection\Socket.php(109): Fabiang\Xmpp\Stream\XMLStream->parse('<proceed xmlns=...')
#18 api\vendor\fabiang\xmpp\src\Connection\Socket.php(165): Fabiang\Xmpp\Connection\Socket->receive()
#19 api\vendor\fabiang\xmpp\src\EventListener\Stream\StartTls.php(80): Fabiang\Xmpp\Connection\Socket->send('<starttls xmlns...')
#20 [internal function]: Fabiang\Xmpp\EventListener\Stream\StartTls->starttls(Object(Fabiang\Xmpp\Event\XMLEvent))
#21 api\vendor\fabiang\xmpp\src\Event\EventManager.php(126): call_user_func(Array, Object(Fabiang\Xmpp\Event\XMLEvent))
#22 api\vendor\fabiang\xmpp\src\Stream\XMLStream.php(361): Fabiang\Xmpp\Event\EventManager->trigger('{urn:ietf:param...', Object(Fabiang\Xmpp\Stream\XMLStream), Array)
#23 api\vendor\fabiang\xmpp\src\Stream\XMLStream.php(163): Fabiang\Xmpp\Stream\XMLStream->trigger()
#24 api\vendor\fabiang\xmpp\src\Connection\Socket.php(109): Fabiang\Xmpp\Stream\XMLStream->parse('<?xml version='...')
#25 api\vendor\fabiang\xmpp\src\Connection\Socket.php(165): Fabiang\Xmpp\Connection\Socket->receive()
#26 api\vendor\fabiang\xmpp\src\Connection\Socket.php(183): Fabiang\Xmpp\Connection\Socket->send('<?xml version="...')
#27 api\vendor\fabiang\xmpp\src\Client.php(113): Fabiang\Xmpp\Connection\Socket->connect()
#28 api\app\commands\xmppTest.php(63): Fabiang\Xmpp\Client->connect()
#29 api\vendor\laravel\framework\src\Illuminate\Console\Command.php(112): xmppTest->fire()
#30 api\vendor\symfony\console\Symfony\Component\Console\Command\Command.php(252): Illuminate\Console\Command->execute(Object(Symfony\Component\Console\Input\ArgvInput), Object(Symfony\Component\Console\Output\ConsoleOutput))
#31 api\vendor\laravel\framework\src\Illuminate\Console\Command.php(100): Symfony\Component\Console\Command\Command->run(Object(Symfony\Component\Console\Input\ArgvInput), Object(Symfony\Component\Console\Output\ConsoleOutput))
#32 api\vendor\symfony\console\Symfony\Component\Console\Application.php(889): Illuminate\Console\Command->run(Object(Symfony\Component\Console\Input\ArgvInput), Object(Symfony\Component\Console\Output\ConsoleOutput))
#33 api\vendor\symfony\console\Symfony\Component\Console\Application.php(193): Symfony\Component\Console\Application->doRunCommand(Object(xmppTest), Object(Symfony\Component\Console\Input\ArgvInput), Object(Symfony\Component\Console\Output\ConsoleOutput))
#34 api\vendor\symfony\console\Symfony\Component\Console\Application.php(124): Symfony\Component\Console\Application->doRun(Object(Symfony\Component\Console\Input\ArgvInput), Object(Symfony\Component\Console\Output\ConsoleOutput))
#35 api\artisan(59): Symfony\Component\Console\Application->run()
#36 {main}

This is a Laravel Framework command
Code bellow:

public function fire() {

        try {           
            $logger = new Logger('xmpp');
            $logger->pushHandler(new StreamHandler('php://stdout', Logger::DEBUG)); 

            $options  = new Options('localhost:5222');

            $authenticationClasses = $options->getAuthenticationClasses();
            unset($authenticationClasses['digest-md5']);            

            $options
                    ->setAuthenticationClasses($authenticationClasses)
                    ->setLogger($logger)
                    ->setUsername('admin')->setPassword('admin');

            $client = new Client($options);            
            $client->connect();       


            sleep(2);
            $client->disconnect(); 
        }catch (\Fabiang\Xmpp\Exception $ex)
        {
            print $ex->getTraceAsString();
        } catch (Exception $ex) {
            print $ex->getMessage().PHP_EOL;
            print $ex->getTraceAsString();
        }        
    }

How can i fix this?
\Thanks

Prebinding possible?

Is it possible to extract the JID/RID/SID so we can attach to the session in javascript?

Multicast

Hi -
This is more of a question than an issue, and I see there hasn't been much action on this library for a while but I figured I'd ask - I'm trying to implement multicast messaging and am using this library - any hints on how I can set that up? I have a general idea but the more I edit the more I've been breaking it it seems. I appreciate any hints.

Ben

XML parsing erase some datas when many buffers

Hi,
first of all, thank you for this library! 👍

I would like to set up the management of the MAM protocol which allows to retrieve the discussion history of a user. I initialized two classes Mam respectfully inheriting from interfaces ProtocolImplementationInterface and BlockingEventListenerInterface

But I have a problem with the buffer....
This is what I can see in the logs :

[2017-11-11 10:01:50] XMPP logs.DEBUG: Connected to 'tcp://127.0.0.1:5222' [] []
[2017-11-11 10:01:50] XMPP logs.DEBUG: Sending data '<?xml version="1.0" encoding="UTF-8"?> <stream:stream to="pataplouf.fr" xmlns:stream="http://etherx.jabber.org/streams" xmlns="jabber:client" version="1.0">' to 'tcp://127.0.0.1:5222' [] []
[2017-11-11 10:01:50] XMPP logs.DEBUG: Listener "Fabiang\Xmpp\EventListener\Stream\Stream" is currently blocking [] []
[2017-11-11 10:01:50] XMPP logs.DEBUG: Received buffer '<?xml version='1.0'?><stream:stream id='6899730158951059925' version='1.0' xml:lang='en' xmlns:stream='http://etherx.jabber.org/streams' from='pataplouf.fr' xmlns='jabber:client'><stream:features><mechanisms xmlns='urn:ietf:params:xml:ns:xmpp-sasl'><mechanism>PLAIN</mechanism><mechanism>X-OAUTH2</mechanism></mechanisms><starttls xmlns='urn:ietf:params:xml:ns:xmpp-tls'/><register xmlns='http://jabber.org/features/iq-register'/></stream:features>' from 'tcp://127.0.0.1:5222' [] []
[2017-11-11 10:01:50] XMPP logs.DEBUG: Sending data '<auth xmlns="urn:ietf:params:xml:ns:xmpp-sasl" mechanism="PLAIN">AGFib3VkaW4xAFBULTE1MTAzOTA5MzRyUlMzSFJsSlNCbFFhLXQ2cUF1</auth>' to 'tcp://127.0.0.1:5222' [] []
[2017-11-11 10:01:50] XMPP logs.DEBUG: Listener "Fabiang\Xmpp\EventListener\Stream\Authentication" is currently blocking [] []
[2017-11-11 10:01:50] XMPP logs.DEBUG: Received buffer '<success xmlns='urn:ietf:params:xml:ns:xmpp-sasl'/>' from 'tcp://127.0.0.1:5222' [] []
[2017-11-11 10:01:50] XMPP logs.DEBUG: Sending data '<?xml version="1.0" encoding="UTF-8"?> <stream:stream to="pataplouf.fr" xmlns:stream="http://etherx.jabber.org/streams" xmlns="jabber:client" version="1.0">' to 'tcp://127.0.0.1:5222' [] []
[2017-11-11 10:01:50] XMPP logs.DEBUG: Listener "Fabiang\Xmpp\EventListener\Stream\Stream" is currently blocking [] []
[2017-11-11 10:01:50] XMPP logs.DEBUG: Received buffer '<?xml version='1.0'?><stream:stream id='15781555238883743717' version='1.0' xml:lang='en' xmlns:stream='http://etherx.jabber.org/streams' from='pataplouf.fr' xmlns='jabber:client'><stream:features><bind xmlns='urn:ietf:params:xml:ns:xmpp-bind'/><session xmlns='urn:ietf:params:xml:ns:xmpp-session'><optional/></session><c ver='CvfXD0VeJBZhyLQosiMuJH3cNmQ=' node='http://www.process-one.net/en/ejabberd/' hash='sha-1' xmlns='http://jabber.org/protocol/caps'/><sm xmlns='urn:xmpp:sm:2'/><sm xmlns='urn:xmpp:sm:3'/><csi xmlns='urn:xmpp:csi:0'/></stream:features>' from 'tcp://127.0.0.1:5222' [] []
[2017-11-11 10:01:50] XMPP logs.DEBUG: Sending data '<iq type="set" id="fabiang_xmpp_5a06bc7e9ded4"><bind xmlns="urn:ietf:params:xml:ns:xmpp-bind"/></iq>' to 'tcp://127.0.0.1:5222' [] []
[2017-11-11 10:01:50] XMPP logs.DEBUG: Listener "Fabiang\Xmpp\EventListener\Stream\Bind" is currently blocking [] []
[2017-11-11 10:01:50] XMPP logs.DEBUG: Received buffer '<iq type='result' id='fabiang_xmpp_5a06bc7e9ded4'><bind xmlns='urn:ietf:params:xml:ns:xmpp-bind'><jid>[email protected]/4435148183316710384300</jid></bind></iq>' from 'tcp://127.0.0.1:5222' [] []
[2017-11-11 10:01:50] XMPP logs.DEBUG: Sending data '<iq type="set" id="fabiang_xmpp_5a06bc7eb4482"><session xmlns="urn:ietf:params:xml:ns:xmpp-session"/></iq>' to 'tcp://127.0.0.1:5222' [] []
[2017-11-11 10:01:50] XMPP logs.DEBUG: Listener "Fabiang\Xmpp\EventListener\Stream\Session" is currently blocking [] []
[2017-11-11 10:01:50] XMPP logs.DEBUG: Received buffer '<iq xml:lang='en' to='[email protected]/4435148183316710384300' from='[email protected]' type='result' id='fabiang_xmpp_5a06bc7eb4482'/>' from 'tcp://127.0.0.1:5222' [] []
[2017-11-11 10:01:50] XMPP logs.DEBUG: Sending data '<iq type="get" id="fabiang_xmpp_5a06bc7ebe31b"><query xmlns="jabber:iq:roster"/></iq>' to 'tcp://127.0.0.1:5222' [] []
[2017-11-11 10:01:50] XMPP logs.DEBUG: Listener "Fabiang\Xmpp\EventListener\Stream\Roster" is currently blocking [] []
[2017-11-11 10:01:50] XMPP logs.DEBUG: Received buffer '<iq xml:lang='en' to='[email protected]/4435148183316710384300' from='[email protected]' type='result' id='fabiang_xmpp_5a06bc7ebe31b'><query xmlns='jabber:iq:roster'><item name='Alexis' jid='[email protected]'><group>Buddies</group></item><item subscription='both' name='Helene' jid='[email protected]'><group>Buddies</group></item></query></iq>' from 'tcp://127.0.0.1:5222' [] []
[2017-11-11 10:01:50] XMPP logs.DEBUG: Sending data '<presence><priority>1</priority></presence>' to 'tcp://127.0.0.1:5222' [] []
[2017-11-11 10:01:50] XMPP logs.DEBUG: Sending data '<iq type="set" id="fabiang_xmpp_5a06bc7ece897"><query xmlns="urn:xmpp:mam:0"><x xmlns="jabber:x:data" type="submit"><field var="FORM_TYPE" type="hidden"><value>urn:xmpp:mam:0</value></field><field var="start"><value>2010-08-07T00:00:00Z</value></field></x></query></iq>' to 'tcp://127.0.0.1:5222' [] []
[2017-11-11 10:01:50] XMPP logs.DEBUG: Listener "Glaan\Xmpp\EventListener\Stream\Mam" is currently blocking [] []
[2017-11-11 10:01:50] XMPP logs.DEBUG: Received buffer '<presence xml:lang='en' to='[email protected]/4435148183316710384300' from='[email protected]/4435148183316710384300'><priority>1</priority></presence>' from 'tcp://127.0.0.1:5222' [] []
[2017-11-11 10:01:50] XMPP logs.DEBUG: Received buffer '<iq xml:lang='en' to='[email protected]/4435148183316710384300' from='[email protected]' type='result' id='fabiang_xmpp_5a06bc7ece897'/>' from 'tcp://127.0.0.1:5222' [] []
[2017-11-11 10:01:50] XMPP logs.DEBUG: Received buffer '<message to='[email protected]/4435148183316710384300' from='[email protected]'><result id='1510307069123621' xmlns='urn:xmpp:mam:0'><forwarded xmlns='urn:xmpp:forward:0'><message xml:lang='en' to='[email protected]' from='[email protected]/7697758090199472108' type='chat' id='fabiang_xmpp_5a0574fd0c80e' xmlns='jabber:client'><archived by='[email protected]' id='1510307069123621' xmlns='urn:xmpp:mam:tmp'/><stanza-id by='[email protected]' id='1510307069123621' xmlns='urn:xmpp:sid:0'/><body>test</body></message><delay from='pataplouf.fr' stamp='2017-11-10T09:44:29.123621Z' xmlns='urn:xmpp:delay'/></forwarded></result></message><message to='[email protected]/4435148183316710384300' from='[email protected]'><result id='1510309092624442' xmlns='urn:xmpp:mam:0'><forwarded xmlns='urn:xmpp:forward:0'><message xml:lang='en' to='[email protected]' from='[email protected]/5545002962534392255112' type='chat' id='fabiang_xmpp_5a057ce48e627' xmlns='jabber:client'><archived by='[email protected]' id='1510309092624442' xmlns='urn:xmpp:mam:tmp'/><stanza-id by='[email protected]' id='1510309092624442' xmlns='urn:xmpp:sid:0'/><body>test</body></message><delay from='pataplouf.fr' stamp='2017-11-10T10:18:12.624442Z' xmlns='urn:xmpp:delay'/></forwarded></result></message><message to='[email protected]/4435148183316710384300' from='[email protected]'><result id='1510309122593564' xmlns='urn:xmpp:mam:0'><forwarded xmlns='urn:xmpp:forward:0'><message xml:lang='en' to='[email protected]' from='[email protected]/7140851732767827425114' type='chat' id='fabiang_xmpp_5a057d02877b5' xmlns='jabber:client'><archived by='[email protected]' id='1510309122593564' xmlns='urn:xmpp:mam:tmp'/><stanza-id by='[email protected]' id='1510309122593564' xmlns='urn:xmpp:sid:0'/><body>test</body></message><delay from='pataplouf.fr' stamp='2017-11-10T10:18:42.593564Z' xmlns='urn:xmpp:delay'/></forwarded></result></message><message to='[email protected]/4435148183316710384300' from='[email protected]'><result id='1510309138952724' xmlns='urn:xmpp:mam:0'><forwarded xmlns='urn:xmpp:forward:0'><message xml:lang='en' to='[email protected]' from='[email protected]/90687550206109155116' type='chat' id='fabiang_xmpp_5a057d12df5d8' xmlns='jabber:client'><archived by='[email protected]' id='1510309138952724' xmlns='urn:xmpp:mam:tmp'/><stanza-id by='[email protected]' id='1510309138952724' xmlns='urn:xmpp:sid:0'/><body>test</body></message><delay from='pataplouf.fr' stamp='2017-11-10T10:18:58.952724Z' xmlns='urn:xmpp:delay'/></forwarded></result></message>' from 'tcp://127.0.0.1:5222' [] []
[2017-11-11 10:01:51] XMPP logs.DEBUG: Received buffer '<message to='[email protected]/4435148183316710384300' from='[email protected]'><result id='1510309268535064' xmlns='urn:xmpp:mam:0'><forwarded xmlns='urn:xmpp:forward:0'><message xml:lang='en' to='[email protected]' from='[email protected]/7613592488955394918118' type='chat' id='fabiang_xmpp_5a057d94790e3' xmlns='jabber:client'><archived by='[email protected]' id='1510309268535064' xmlns='urn:xmpp:mam:tmp'/><stanza-id by='[email protected]' id='1510309268535064' xmlns='urn:xmpp:sid:0'/><body>test</body></message><delay from='pataplouf.fr' stamp='2017-11-10T10:21:08.535064Z' xmlns='urn:xmpp:delay'/></forwarded></result></message><message to='[email protected]/4435148183316710384300' from='[email protected]'><result id='1510328134534439' xmlns='urn:xmpp:mam:0'><forwarded xmlns='urn:xmpp:forward:0'><message xml:lang='en' to='[email protected]' from='[email protected]/16509411186299495555106' type='chat' id='purple5eabbb06' xmlns='jabber:client'><archived by='[email protected]' id='1510328134534439' xmlns='urn:xmpp:mam:tmp'/><stanza-id by='[email protected]' id='1510328134534439' xmlns='urn:xmpp:sid:0'/><active xmlns='http://jabber.org/protocol/chatstates'/><body>Ceci est un message texte un peu plus long... avec un retour de ligne &amp; des caractères spéciaux!</body></message><delay from='pataplouf.fr' stamp='2017-11-10T15:35:34.534439Z' xmlns='urn:xmpp:delay'/></forwarded></result></message><message to='[email protected]/4435148183316710384300' from='[email protected]'><result id='1510328134541587' xmlns='urn:xmpp:mam:0'><forwarded xmlns='urn:xmpp:forward:0'><message xml:lang='en' to='[email protected]' from='[email protected]/16509411186299495555106' type='chat' id='purple5eabbb06' xmlns='jabber:client'><archived by='[email protected]' id='1510328134541587' xmlns='urn:xmpp:mam:tmp'/><stanza-id by='[email protected]' id='1510328134541587' xmlns='urn:xmpp:sid:0'/><active xmlns='http://jabber.org/protocol/chatstates'/><body>Ceci est un message texte un peu plus long... avec un retour de ligne &amp; des caractères spéciaux!</body></message><delay from='pataplouf.fr' stamp='2017-11-10T15:35:34.541587Z' xmlns='urn:xmpp:delay'/></forwarded></result></message><message to='[email protected]/4435148183316710384300' from='[email protected]'><result id='1510328224170669' xmlns='urn:xmpp:mam:0'><forwarded xmlns='urn:xmpp:forward:0'><message xml:lang='en' to='[email protected]' from='[email protected]/16509411186299495555106' type='chat' id='purple5eabbb0a' xmlns='jabber:client'><archived by='[email protected]' id='1510328224170669' xmlns='urn:xmpp:mam:tmp'/><stanza-id by='[email protected]' id='1510328224170669' xmlns='urn:xmpp:sid:0'/><active xmlns='http://jabber.org/protocol/chatstates'/><body>Un petit test, désolé ;)</body></message><delay from='pataplouf.fr' stamp='2017-11-10T15:37:04.170669Z' xmlns='urn:xmpp:delay'/></forwarded></result></message><message to='[email protected]/4435148183316710384300' from='[email protected]'><fin complete='true' xmlns='urn:xmpp:mam:0'><set xmlns='http://jabber.org/protocol/rsm'><count>8</count><first>1510307069123621</first><last>1510328224170669</last></set></fin><no-store xmlns='urn:xmpp:hints'/></message>' from 'tcp://127.0.0.1:5222' [] []
[2017-11-11 10:01:51] XMPP logs.DEBUG: Sending data '</stream:stream>' to 'tcp://127.0.0.1:5222' [] []
[2017-11-11 10:01:51] XMPP logs.DEBUG: Disconnected from 'tcp://127.0.0.1:5222' [] []

As you can see, the answer is divided in 4 buffers... this can be more that in the futur 🤕

And this is what I get back with theXMLEvent::getParameters() in my BlockingEventListenerInterface :

<?xml version="1.0" encoding="UTF-8"?>
<stream:stream xmlns:stream="http://etherx.jabber.org/streams" id="16297490195230370045" version="1.0" xml:lang="en" from="pataplouf.fr" xmlns="jabber:client">
  <message to="[email protected]/2733600 801839882585298" from="[email protected]">
    <result id="1510328134534439" xmlns="urn:xmpp:mam:0">
      <forwarded xmlns="urn:xmpp:forward:0">
        <message xml:lang="en" to="[email protected]" from="[email protected]/16509411186299495555106" type="chat" id="purple5eabbb06" xmlns="jabber:client">
          <archived by="[email protected]" id="1510328134534439" xmlns="urn:xmpp:mam:tmp"/>
          <stanza-id by="[email protected]" id="1510328134534439" xmlns="urn:xmpp:sid:0"/>
          <active xmlns="http://jabber.org/protocol/chatstates"/>
          <body>Ceci est un message texte un peu plus long...
avec un retour de ligne &amp; des caractères spéciaux!</body>
        </message>
        <delay from="pataplouf.fr" stamp="2017-11-10T15:35:34.534439Z" xmlns="urn:xmpp:delay"/>
      </forwarded>
    </result>
  </message>
  <message to="[email protected]/2733600801839882585298" from="[email protected]">
    <result id="1510328134541587" xmlns="urn:xmpp:mam:0">
      <forwarded xmlns="urn:xmpp:forward:0">
        <message xml:lang="en" to="[email protected]" from="[email protected]/16509411186299495555106" type="chat" id="purple5eabbb06" xmlns="jabber:client">
          <archived by="[email protected]" id="1510328134541587" xmlns="urn:xmpp:mam:tmp"/>
          <stanza-id by="[email protected]" id="1510328134541587" xmlns="urn:xmpp:sid:0"/>
          <active xmlns="http://jabber.org/protocol/chatstates"/>
          <body>Ceci est un message texte un peu plus long...
avec un retour de ligne &amp; des caractères spéciaux!</body>
        </message>
        <delay from="pataplouf.fr" stamp="2017-11-10T15:35:34.541587Z" xmlns="urn:xmpp:delay"/>
      </forwarded>
    </result>
  </message>
  <message to="[email protected]/2733600801839882585298" from="[email protected]">
    <result id="1510328224170669" xmlns="urn:xmpp:mam:0">
      <forwarded xmlns="urn:xmpp:forward:0">
        <message xml:lang="en" to="[email protected]" from="[email protected]/16509411186299495555106" type="chat" id="purple5eabbb0a" xmlns="jabber:client">
          <archived by="[email protected]" id="1510328224170669" xmlns="urn:xmpp:mam:tmp"/>
          <stanza-id by="[email protected]" id="1510328224170669" xmlns="urn:xmpp:sid:0"/>
          <active xmlns="http://jabber.org/protocol/chatstates"/>
          <body>Un petit test, désolé ;)</body>
        </message>
        <delay from="pataplouf.fr" stamp="2017-11-10T15:37:04.170669Z" xmlns="urn:xmpp:delay"/>
      </forwarded>
    </result>
  </message>
  <message to="[email protected]/2733600801839882585298" from="[email protected]">
    <fin complete="true" xmlns="urn:xmpp:mam:0">
      <set xmlns="http://jabber.org/protocol/rsm">
        <count>8</count>
        <first>1510307069123621</first>
        <last>1510328224170669</last>
      </set>
    </fin>
    <no-store xmlns="urn:xmpp:hints"/>
  </message>
</stream:stream>

So in the logs, I see 8 messages (separated in the different buffer) while I only get 3 messages ...
These messages are the 3 that are in the last buffer...
So I think that the problem come from the The XMLStream::parse() and more precisely from XMLStream::clearDocument() but I don't see how to resolve this problem properly...

composer require fabiang/xmpp (error)

Hello.
The following error is generated when I run composer require fabiang/xmpp

Your requirements could not be resolved to an installable set of packages.

Problem 1
- The requested package fabiang/xmpp No version set (parsed as 1.0.0) could not be found.

Potential causes:

Read https://getcomposer.org/doc/articles/troubleshooting.md for further common problems.

Installation failed, reverting ./composer.json to its original content.

Could someone help me ??

PHP 5.6: Can't connect to the server that uses self-signed certificate.

In connect() method of Fabiang\Xmpp\Stream\SocketClient class it is necessary to use stream_socket_client() with the sixth attribute: stream_context_create($options)
where $options contains settings of SSL, for example:

// call stream_socket_client with custom error handler enabled
$handler = new ErrorHandler(
    function ($address, $timeout, $flags) {
        $options = [
            'ssl' => [
                'allow_self_signed' => true,
                'verify_peer_name' => false,
            ],
        ];
        $context = stream_context_create($options);
        return stream_socket_client($address, $errno, $errstr, $timeout, $flags, $context);
    },
    $this->address,
    $timeout,
    $flags
);

This is required so as to have possibility to use self signed SSL certificates.

GCM conection

I am trying send message to GCM, with example.php code, and it return:
[2014-11-12 15:45:49] xmpp.DEBUG: Listener "Fabiang\Xmpp\EventListener\Stream\Stream" is currently blocking [] []

Example of echo bot

As said in #10 we need example of code for message receiving.

I tried to add event listener for {http://etherx.jabber.org/streams}message and for {jabber:client}message with no result. Callback just didn't calling.

Also I want to understand how client can be used in cycle for processing incoming messages in real-time.

Group chat error

After each message of Bot in Group chat there is a notification:

Bot (bot@****) has left the room (This participant is kicked from the room because he sent an error message to another participant: service-unavailable).

But message sending is working as expected.

got SSL verification failed

SSL routines:ssl3_get_server_certificate:certificate verify failed
error:14090086:SSL routines:ssl3_get_server_certificate:certificate verify failed in /var/www/html/cobaxmpp/vendor/fabiang/xmpp/src/Stream/SocketClient.php on line 210

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.