pub problem with GRPC - empty response from Tinode

211 views
Skip to first unread message

Soy yo

unread,
Dec 18, 2020, 11:49:08 AM12/18/20
to Tinode General
When I send a message as a root user from user A to user B, by making a php/GRPC call pub request does not return anything. Is this normal?

To send a message, first I send 2 requests sub and pub:

sub request:

$response = $service->sub(random_int(100000, 999999), $topic,0);
echo $response;

echo $response returns:

{"id":"143837","topic":"usrHGshCFWe5aI","code":200,"text":"ok"}  

pub request:

$response = $service->pub(random_int(100000, 999999), $topic, $message);
echo $response;

echo $response does not return anything but message is successfully sent.

If I change echo $response; to to var_dump(response); it returns:

bool(false) 

There are no php errors, nothing. Messages are being sent but I get empty response from Tinode.

Server log: 

2020/12/18 16:47:23 grpc in: sub:<id:"470448" topic:"usrHGshCFWe5aI" get_query:<what:"desc" > > on_behalf_of:"usraDj1grBOVxw" auth_level:ROOT  fg8-F3A4v7U
2020/12/18 16:47:23 grpc in: pub:<id:"574483" topic:"usrHGshCFWe5aI" no_echo:true content:"\"jyodfdfddfyoyoyoyo\"" > on_behalf_of:"usraDj1grBOVxw"  fg8-F3A4v7U

Gene

unread,
Dec 18, 2020, 1:45:32 PM12/18/20
to Tinode General
Sorry, I'm not going to debug your code. If you need help with debugging your code please have your employer pay us for it.

If you believe there is a bug in Tinode, please demonstrate it using stock tools.

Soy yo

unread,
Feb 26, 2021, 4:58:02 AM2/26/21
to Tinode General

Its not a problem with my code. All the GRPC requests that need to attached firstly don't not return anything, even in case of error.

Firstly I was thinking that for some reason I only get reply to the first request but it's not a case.

For example, I try do leave a group. It's a php code, but it does not matter, I just want to show the problem. So, to leave a group I send 4 requests:

$response1 = $service->hi(random_int(100000, 999999), $user_agent, $ver, $lang);
echo $response1;
$response2 = $service->logintoken(random_int(100000, 999999), $admin, $passB, $schemaB);
echo $response2;  
$response3 = $service->attach(random_int(100000, 999999), $topic,0);
echo $response3; 
$response4 = $service->leave(random_int(100000, 999999), $topic, $leave); 
echo $response4;  

But I only get 3 replies:

$response1
{"id":"767468","code":201,"text":"created"}  
$response2
{"id":"673320","code":200,"text":"ok","params":{"token":"InR0UFFNdDVROWF4ckxVdGdIZ0FCQUFFQWZXYlhsbUtCakFOcUUwLysvS2JuVzNKQkswL1FwamtoOVVlM1dYYlAyWEE9Ig==","expires":"IjIwMjEtMDMtMTJUMDg6NTk6MjMuMzM1WiI=","user":"InVzcnR0UFFNdDVROWF3Ig==","authlvl":"InJvb3Qi"}} 
$response3
{"id":"935513","topic":"grpcGAejdVSS_I","code":200,"text":"ok"}
$response4
empty 

I tried to send a leave request with an invalid topic ID:
$response4 = $service->leave(random_int(100000, 999999), "grpInvalidTopic", $leave);   

The same - it does not return anything.

Then I sent a leave request without sending attach request firstly. Now it returns error as it should be:

//$response3 = $service->attach(random_int(100000, 999999), $topic,0);  
$response4 = $service->leave(random_int(100000, 999999), "grpInvalidTopic", $leave); 
echo $response4  

$response4
{"id":"431224","topic":"grpcGAejdVSS_I","code":409,"text":"must attach first"}  

So, all the requests like leave, pub etc are being processed successfully or with error but if a request needs to be attached firstly, it does not return anything. There are no errors on the server either.

Soy yo

unread,
Feb 26, 2021, 5:11:39 AM2/26/21
to Tinode General
P.S. With "attach" I mean sub requests. Just my function is named "attach" but it sends sub requests.

Gene

unread,
Feb 26, 2021, 1:19:45 PM2/26/21
to Tinode General
What do you see in the server log?
What is '$leave'?

Soy yo

unread,
Feb 28, 2021, 7:27:31 AM2/28/21
to Tinode General
$leave is a value that indicates to unsubscribe or not. In my case it's true

This is what I see in server log:

I2021/02/28 12:15:16 grpc: session started BtkbUclUA8w XXX.XXX.XXX.XX:56276 2
I2021/02/28 12:15:16 grpc in: hi:<id:"421737" user_agent:"php/grpc" ver:"1" lang:"es-ES" >  BtkbUclUA8w
I2021/02/28 12:15:16 grpc in: login:<id:"877389" scheme:"token" secret:"\266\323\3202\336P\365\254\241\010K`\036\000\001\000\001\000Q\023\323<\230'\340\326k\326\316T6e\037x\312=|SJM\241\210\205\310\030!\017Z:\342" > auth_level:ROOT  BtkbUclUA8w
I2021/02/28 12:15:16 grpc in: sub:<id:"600340" topic:"grpcGAejdVSS_I" get_query:<what:"desc" > > on_behalf_of:"usrpDPgde-kKYI" auth_level:ROOT  BtkbUclUA8w
I2021/02/28 12:15:16 grpc in: leave:<id:"941696" topic:"grpcGAejdVSS_I" unsub:true > on_behalf_of:"usrpDPgde-kKYI"  BtkbUclUA8w

leave request works and user leaves the topic successfully but leave request does not return anything. As I wrote, any requests that need sub first don't return anything. 

Gene

unread,
Feb 28, 2021, 1:08:15 PM2/28/21
to Tinode General
Can you reproduce the problem using tn-cli?

Soy yo

unread,
Mar 9, 2021, 5:43:40 AM3/9/21
to Tinode General
removing  get_query:<what:"desc" from sub fixed the problem, now I get response

thanks.
Reply all
Reply to author
Forward
0 new messages