Create new p2p topic

38 views
Skip to first unread message

Tinode User

unread,
Nov 4, 2025, 5:46:34 AM (6 days ago) Nov 4
to Tinode General
1.Requirement: In my system I create user programmatically using tinode cli, then create p2p topics for two users ,
2.how can I do this?
3.how to get the userid as it shows bigint in users table in database, and can only see in settings-view

Gene

unread,
Nov 4, 2025, 6:07:20 AM (6 days ago) Nov 4
to Tinode General
On Tuesday, November 4, 2025 at 1:46:34 PM UTC+3 Tinode User wrote:
1.Requirement: In my system I create user programmatically using tinode cli, then create p2p topics for two users ,
2.how can I do this?

Here are the three ways you can create users:

Once the users are created, subscribe them to each other (tn-cli sub command).
 
3.how to get the userid as it shows bigint in users table in database, and can only see in settings-view

When you create a user, you get user ID in the {ctrl} response (use {acc.login=false}). 
 

Tinode User

unread,
Nov 4, 2025, 6:36:10 AM (6 days ago) Nov 4
to Tinode General
for sub we need userid, and then how can we retrive the userid for existing user, as it appears 
as if i user resolve, it only shows:
tn> resolve host1_guest2
tn> useradd -P password --name 'Guest One' --cred basic host1_guest2
<= 201 created
tn> resolve host1_guest2
<= 200 ok (fnd)
<= 200 ok (fnd)
<= meta sub fnd
<= 200 ok (fnd)
<=
tn>
no user id

Gene

unread,
Nov 4, 2025, 7:13:58 AM (6 days ago) Nov 4
to Tinode General
On Tuesday, November 4, 2025 at 2:36:10 PM UTC+3 Tinode User wrote:
for sub we need userid, and then how can we retrive the userid for existing user, as it appears 
as if i user resolve, it only shows:
tn> resolve host1_guest2
tn> useradd -P password --name 'Guest One' --cred basic host1_guest2
<= 201 created
tn> resolve host1_guest2
<= 200 ok (fnd)
<= 200 ok (fnd)
<= meta sub fnd
<= 200 ok (fnd)
<=
tn>
no user id

You can make this change manually or wait for the next release.

Tinode User

unread,
Nov 5, 2025, 8:06:24 AM (5 days ago) Nov 5
to Tinode General
Being a root user , how can I create p2p topic between two users whose id i have?
Please give me some ways to create p2p not manually login user1 send command sub with user2 ID, then login user2 then send command sub with user1 ID.
what i am doing is creating a api -server.py that connects to gRPC to execute.

Tinode User

unread,
Nov 5, 2025, 8:30:28 AM (5 days ago) Nov 5
to Tinode General
console logs:
I2025/11/05 18:25:09 grpc: session started eS4iaj9pZgw [::1]:53389 3
I2025/11/05 18:25:09 grpc in: hi:{id:"1"  user_agent:"Middleman/1.0"  ver:"1.0"  lang:"EN"  background:true} eS4iaj9pZgw
I2025/11/05 18:25:09 grpc in: login:{id:"2"  scheme:"basic"  secret:"admin01:adminpass"} eS4iaj9pZgw
I2025/11/05 18:25:09 grpc in: acc:{id:"3"  user_id:"new"  scheme:"basic"  secret:"host1_guest15:guestpass_static"  desc:{public:"{\"fn\": \"Host1 Guest 15\"}"}  cred:{method:"tel"  value:"host1_guest15"}}  extra:{auth_level:ROOT} eS4iaj9pZgw
I2025/11/05 18:25:10 grpc in: sub:{id:"4"  topic:"p2pusr3uMqoCXZEtM"  set_query:{sub:{mode:"JRWS"}}}  extra:{on_behalf_of:"usrkq_lN_uzkmg"} eS4iaj9pZgw
W2025/11/05 18:25:10 s.dispatch: non-root asigned msg.from eS4iaj9pZgw
E2025/11/05 18:25:25 grpc: recv eS4iaj9pZgw rpc error: code = Canceled desc = context canceled

Gene

unread,
Nov 5, 2025, 9:02:39 AM (5 days ago) Nov 5
to Tinode General
On Wednesday, November 5, 2025 at 4:30:28 PM UTC+3 Tinode User wrote:
console logs:
I2025/11/05 18:25:09 grpc: session started eS4iaj9pZgw [::1]:53389 3
I2025/11/05 18:25:09 grpc in: hi:{id:"1"  user_agent:"Middleman/1.0"  ver:"1.0"  lang:"EN"  background:true} eS4iaj9pZgw
I2025/11/05 18:25:09 grpc in: login:{id:"2"  scheme:"basic"  secret:"admin01:adminpass"} eS4iaj9pZgw

^^^ This user must be the root user for 'on_behalf_of' to work

I2025/11/05 18:25:09 grpc in: acc:{id:"3"  user_id:"new"  scheme:"basic"  secret:"host1_guest15:guestpass_static"  desc:{public:"{\"fn\": \"Host1 Guest 15\"}"}  cred:{method:"tel"  value:"host1_guest15"}}  extra:{auth_level:ROOT} eS4iaj9pZgw

The extra:{auth_level:ROOT} has no effect. Maybe I should issue an error here.

I2025/11/05 18:25:10 grpc in: sub:{id:"4"  topic:"p2pusr3uMqoCXZEtM"  set_query:{sub:{mode:"JRWS"}}}  extra:{on_behalf_of:"usrkq_lN_uzkmg"} eS4iaj9pZgw
W2025/11/05 18:25:10 s.dispatch: non-root asigned msg.from eS4iaj9pZgw

admin01:adminpass is not a root user.

Tinode User

unread,
Nov 5, 2025, 9:22:01 AM (5 days ago) Nov 5
to Tinode General
On Wednesday, November 5, 2025 at 7:32:39 PM UTC+5:30 Gene wrote:
On Wednesday, November 5, 2025 at 4:30:28 PM UTC+3 Tinode User wrote:
console logs:
I2025/11/05 18:25:09 grpc: session started eS4iaj9pZgw [::1]:53389 3
I2025/11/05 18:25:09 grpc in: hi:{id:"1"  user_agent:"Middleman/1.0"  ver:"1.0"  lang:"EN"  background:true} eS4iaj9pZgw
I2025/11/05 18:25:09 grpc in: login:{id:"2"  scheme:"basic"  secret:"admin01:adminpass"} eS4iaj9pZgw

^^^ This user must be the root user for 'on_behalf_of' to work

I2025/11/05 18:25:09 grpc in: acc:{id:"3"  user_id:"new"  scheme:"basic"  secret:"host1_guest15:guestpass_static"  desc:{public:"{\"fn\": \"Host1 Guest 15\"}"}  cred:{method:"tel"  value:"host1_guest15"}}  extra:{auth_level:ROOT} eS4iaj9pZgw

The extra:{auth_level:ROOT} has no effect. Maybe I should issue an error here.

I2025/11/05 18:25:10 grpc in: sub:{id:"4"  topic:"p2pusr3uMqoCXZEtM"  set_query:{sub:{mode:"JRWS"}}}  extra:{on_behalf_of:"usrkq_lN_uzkmg"} eS4iaj9pZgw
W2025/11/05 18:25:10 s.dispatch: non-root asigned msg.from eS4iaj9pZgw

admin01:adminpass is not a root user.
I have confirmed that it is root user, but you can also help by telling how to create a root user matching requirement 

Gene

unread,
Nov 5, 2025, 9:26:07 AM (5 days ago) Nov 5
to Tinode General
On Wednesday, November 5, 2025 at 5:22:01 PM UTC+3 Tinode User wrote:
On Wednesday, November 5, 2025 at 7:32:39 PM UTC+5:30 Gene wrote:
On Wednesday, November 5, 2025 at 4:30:28 PM UTC+3 Tinode User wrote:
console logs:
I2025/11/05 18:25:09 grpc: session started eS4iaj9pZgw [::1]:53389 3
I2025/11/05 18:25:09 grpc in: hi:{id:"1"  user_agent:"Middleman/1.0"  ver:"1.0"  lang:"EN"  background:true} eS4iaj9pZgw
I2025/11/05 18:25:09 grpc in: login:{id:"2"  scheme:"basic"  secret:"admin01:adminpass"} eS4iaj9pZgw

^^^ This user must be the root user for 'on_behalf_of' to work

I2025/11/05 18:25:09 grpc in: acc:{id:"3"  user_id:"new"  scheme:"basic"  secret:"host1_guest15:guestpass_static"  desc:{public:"{\"fn\": \"Host1 Guest 15\"}"}  cred:{method:"tel"  value:"host1_guest15"}}  extra:{auth_level:ROOT} eS4iaj9pZgw

The extra:{auth_level:ROOT} has no effect. Maybe I should issue an error here.

I2025/11/05 18:25:10 grpc in: sub:{id:"4"  topic:"p2pusr3uMqoCXZEtM"  set_query:{sub:{mode:"JRWS"}}}  extra:{on_behalf_of:"usrkq_lN_uzkmg"} eS4iaj9pZgw
W2025/11/05 18:25:10 s.dispatch: non-root asigned msg.from eS4iaj9pZgw

admin01:adminpass is not a root user.
I have confirmed that it is root user,

It is not.
 
but you can also help by telling how to create a root user matching requirement 

You can help yourself by reading the rest of the FAQ, which I already referenced for you once.

Gene

unread,
Nov 5, 2025, 9:30:59 AM (5 days ago) Nov 5
to Tinode General
On Wednesday, November 5, 2025 at 4:30:28 PM UTC+3 Tinode User wrote:
console logs:
I2025/11/05 18:25:09 grpc: session started eS4iaj9pZgw [::1]:53389 3
I2025/11/05 18:25:09 grpc in: hi:{id:"1"  user_agent:"Middleman/1.0"  ver:"1.0"  lang:"EN"  background:true} eS4iaj9pZgw
I2025/11/05 18:25:09 grpc in: login:{id:"2"  scheme:"basic"  secret:"admin01:adminpass"} eS4iaj9pZgw
I2025/11/05 18:25:09 grpc in: acc:{id:"3"  user_id:"new"  scheme:"basic"  secret:"host1_guest15:guestpass_static"  desc:{public:"{\"fn\": \"Host1 Guest 15\"}"}  cred:{method:"tel"  value:"host1_guest15"}}  extra:{auth_level:ROOT} eS4iaj9pZgw
I2025/11/05 18:25:10 grpc in: sub:{id:"4"  topic:"p2pusr3uMqoCXZEtM"  set_query:{sub:{mode:"JRWS"}}}  extra:{on_behalf_of:"usrkq_lN_uzkmg"} eS4iaj9pZgw

BTW, topic:"p2pusr3uMqoCXZEtM" should be topic:"usrXXXXXXXXXX", not "p2pXXXXX".

The 'p2pusr3uMqoCXZEtM' is some kind of weirdness that makes no sense at all.
Reply all
Reply to author
Forward
0 new messages