Code Monkey home page Code Monkey logo

Comments (9)

wakumaku avatar wakumaku commented on September 22, 2024

You're using the wrong port for RPC.
Look at the example on readme.md

'server' => 'http://127.0.0.1:4560'
El 14/04/2015 11:12, "puneetxc" [email protected] escribió:

I am using this
$rpc = new \GameNet\Jabber\RpcClient([
'server' => 'http://localhost:5222',
'host' => 'localhost',
'debug' => true,
]);

//Create 2 new users with name Ivan and Petr with password someStrongPassword
$rpc->createUser('Ivan', 'someStrongPassword');

I am getting this below error. What may be the issue?

Fatal error: Uncaught exception 'RuntimeException' with message 'Error
execution command 'register'' with parameters array ( 'host' =>
'localhost', 'user' => 'Ivan', 'password' => 'someStrongPassword', ).
Response: stream:error/stream:error/stream:stream'
in
/var/www/first/vendor/gamenet/php-jabber-rpc/lib/GameNet/Jabber/RpcClient.php:96
Stack trace: #0
/var/www/first/vendor/gamenet/php-jabber-rpc/lib/GameNet/Jabber/Mixins/UserTrait.php(64):
GameNet\Jabber\RpcClient->sendRequest('register', Array) #1
#1
/var/www/first/vendor/aaa.php(10):
GameNet\Jabber\RpcClient->createUser('Ivan', 'someStrongPassw...') #2
{main} thrown in
/var/www/first/vendor/gamenet/php-jabber-rpc/lib/GameNet/Jabber/RpcClient.php
on line 96


Reply to this email directly or view it on GitHub
#1.

from php-jabber-rpc.

puneetxc avatar puneetxc commented on September 22, 2024

My jabber is installed on 5222. I have tried above port also But still getting the same error.

When i visit the url "http://127.0.0.1:4560/", it shows no page avaliable as my jabber is listening on 5222

from php-jabber-rpc.

wakumaku avatar wakumaku commented on September 22, 2024

5222 is the default TCP port for XMPP client connections, for RCP usually is 4560 and you have to enable it on your jabber server. In my case (ejabberd) I had to uncomment a pair of lines in the modules section on ejabberd.yml config file to enable the RPC service.

https://github.com/wakumaku/ejabberd/blob/master/ejabberd.yml.example#L125

from php-jabber-rpc.

puneetxc avatar puneetxc commented on September 22, 2024

Ohh. Thanks, It worked like charm now.

from php-jabber-rpc.

puneetxc avatar puneetxc commented on September 22, 2024

Hello, I am trying to get the roaster
$rpc->getRoster('48');

Fatal error: Uncaught exception 'RuntimeException' with message 'Error execution command 'get_roster'' with parameters array ( 'user' => '48', 'host' => 'localhost', ). Response: faultCode-112faultStringError -112 Unknown call: {call,get_roster, [{struct,[{user,<<"48">>},{host,<<"localhost">>}]}]}' in /var/www/first/vendor/gamenet/php-jabber-rpc/lib/GameNet/Jabber/RpcClient.php:95 Stack trace: #0 /var/www/first/vendor/gamenet/php-jabber-rpc/lib/GameNet/Jabber/Mixins/RosterTrait.php(63): GameNet\Jabber\RpcClient->sendRequest('get_roster', Array) #1 /var/www/first/vendor/aaa.php(11): GameNet\Jabber\RpcClient->getRoster('48') #2 {main} thrown in /var/www/first/vendor/gamenet/php-jabber-rpc/lib/GameNet/Jabber/RpcClient.php on line 95

from php-jabber-rpc.

wakumaku avatar wakumaku commented on September 22, 2024

In order to use the get_roster command you need to install the mod_admin_extra module in your ejabberd server

https://github.com/processone/ejabberd-contrib/tree/master/mod_admin_extra#L68

The suported calls you are able to do are the ones showed when you type

ejabberdctl

from php-jabber-rpc.

puneetxc avatar puneetxc commented on September 22, 2024

I am really sorry to disturb you again
I have added both modules mod_admin_extra and mod_muc_admin. Now get roaster is working fine but again when i try to add roaster

Fatal error: Uncaught exception 'RuntimeException' with message 'Error execution command 'add_rosteritem'' with parameters array ( 'localuser' => '49', 'localserver' => 'localhost', 'user' => '48', 'server' => 'localhost', 'nick' => '49', 'group' => 'Friend', 'subs' => 'both', ). Response: ' in /var/www/first/vendor/gamenet/php-jabber-rpc/lib/GameNet/Jabber/RpcClient.php:95 Stack trace: #0 /var/www/first/vendor/gamenet/php-jabber-rpc/lib/GameNet/Jabber/Mixins/RosterTrait.php(113): GameNet\Jabber\RpcClient->sendRequest('add_rosteritem', Array) #1 /var/www/first/vendor/aaa.php(12): GameNet\Jabber\RpcClient->addRosterItem('49', '48', '49', 'Friend') #2 {main} thrown in /var/www/first/vendor/gamenet/php-jabber-rpc/lib/GameNet/Jabber/RpcClient.php on line 95

from php-jabber-rpc.

wakumaku avatar wakumaku commented on September 22, 2024

No problem, but maybe this is not the best place where to discuss that because your errors are not related with library issues.
My recomendation is to test the add_rosteritem from the command line to debug and get more detailed errors and when it works translate the command to your code.

from php-jabber-rpc.

puneetxc avatar puneetxc commented on September 22, 2024

I have resolved the issue. It appears i was using older mod_admin_extra file.

Thanks for your help

from php-jabber-rpc.

Related Issues (7)

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.