tdlib / telegram-bot-api

Telegram Bot API server
https://core.telegram.org/bots
Boost Software License 1.0
2.94k stars 569 forks source link

How can I be sure that Telegram BOT API local server is running properly? #591

Open mostafa-norouzi opened 1 month ago

mostafa-norouzi commented 1 month ago

Hi

I installed API on my centos 7.x and then below command :

bin/telegram-bot-api --api-id $TELEGRAM_API_ID --api-hash $TELEGRAM_API_HASH --local &

So in task manager I can see it, also at first in trace process there are a lot of

clock_gettime(CLOCK_MONOTONIC, {tv_sec=6937094, tv_nsec=628648907}) = 0
clock_gettime(CLOCK_MONOTONIC, {tv_sec=6937094, tv_nsec=628717456}) = 0
clock_gettime(CLOCK_MONOTONIC, {tv_sec=6937094, tv_nsec=628755808}) = 0

And after a few minutes, a lot of :

clock_gettime(CLOCK_MONOTONIC, 0x7fffc67fb2d0) = -1 ENOSYS (Function not implemented)
clock_gettime(CLOCK_MONOTONIC, 0x7fffc67fb2c0) = -1 ENOSYS (Function not implemented)
clock_gettime(CLOCK_MONOTONIC, 0x7fffc67fb470) = -1 ENOSYS (Function not implemented)
clock_gettime(CLOCK_MONOTONIC, 0x7fffc67fb4f0) = -1 ENOSYS (Function not implemented)

So that means local server is not working?

levlam commented 1 month ago

If you send requests and receive responses, then server works. If it is running, then it should work.

mostafa-norouzi commented 1 month ago

The problem is when I hit the URL : https://x.x.x.x:9090 I faced with [refused to connect.] Also in Terminal :

[root@srv telegram-bot-api]# wget localhost:9090
--2024-05-30 14:34:15--  http://localhost:9090/
Resolving localhost (localhost)... ::1, ::1, ::1, ...
Connecting to localhost (localhost)|::1|:9090... failed: Connection refused.
Connecting to localhost (localhost)|::1|:9090... failed: Connection refused.
Connecting to localhost (localhost)|::1|:9090... failed: Connection refused.
Connecting to localhost (localhost)|127.0.0.1|:9090... failed: Connection refused.
Connecting to localhost (localhost)|127.0.0.1|:9090... failed: Connection refused.
Connecting to localhost (localhost)|127.0.0.1|:9090... failed: Connection refused.
Connecting to localhost (localhost)|127.0.0.1|:9090... failed: Connection refused.

So I guess something is wrong.

levlam commented 1 month ago

You must connect to 8081 unless you specified a different port.

mostafa-norouzi commented 1 month ago

Yes I changed port number to 9090. I Switched https to http and problem fixed! Just to answer my question to be sure service is working properly, need to check below URL in browser:

http://xxxx:[port]/

and result is something like below in json format same as Telegram server:

{"ok":false,"error_code":404,"description":"Not Found"}