Simple live support server with PHP Swoole Websocket and Telegram API

Related tags

Frameworks telgraf
Overview

Telgraf

Simple live support server with PHP Swoole Websocket and Telegram API.

Usage

Server Setup

  1. Clone repository with following command.
    git clone https://github.com/ademalidurmus/telgraf.git
    
  2. Enter project folder with cd telgraf command.
  3. Update initial credentials (BOT_TOKEN, APP_SECRET and APP_CHAT_IDS) from .env.example file via any text editor.
  4. You can use some makefile commands for configurations. Makefile commands like make [COMMAND], for details you can run make help.
    1. Use make env command for create environment file.

      You need update initial credentials from .env.example file before using makefile commands. If you were run make .env command, you may need update .env and .env.example files at the same times.

    2. Run make build for building telgraf application. This command also run composer install for dependency installation and serves the application.
    3. If you are already built app, and you need just serve app you can run make up. For restart app server you can run make restart, for stop app server you can also run make stop.
    4. For access to cli or container bash you can run make cli.
    5. make status command is shows containers status like docker ps. If you want to show telgraf logs you can use make logs command.
    6. make set_webhook command setting telegram bot webhook using defined environments.
    7. make delete_webhook command delete telegram bot webhook using defined environments.
    8. make clean command stops telgraf server, delete .env file and clear all log files.

Telegram Bot Commands

  • /start command is for the starting agent session to accept any client connections.
  • /stop command is for the stopping agent session.
  • /close command is for the stopping current client connection. The agent will continue to wait for any connection.
  • /add [CHAT_ID] command is used to add a new agent to the agent access control list.
  • /remove [CHAT_ID] command for removing the agent from the agent access control list.

API Docs

wss://{your_webserver_url}

  • type: enum(message|info), action type
  • content: string, message text or action details
  • attributes: object, message attributes
    • attributes.name: string, client name

Sample websocket message history:

❌ Disconnected from wss://telgraf.durmus.me
⬇️ {"type":"info","content":"connection unassigned","attributes":[]}
⬆️ {"type":"message","content":"Test Client Message 2","attributes":{"name":"Client 1"}}
⬇️ {"type":"message","content":"Test Message 2","attributes":{"name":"Adem Ali D."}}
⬆️ {"type":"message","content":"Test Client Message 1","attributes":{"name":"Client 1"}}
⬇️ {"type":"message","content":"Test Message 1","attributes":{"name":"Adem Ali D."}}
⬇️ {"type":"info","content":"connection assigned","attributes":[]}
✔️ Connected to wss://telgraf.durmus.me

License

MIT

You might also like...
Hprose asynchronous client & standalone server based on swoole
Hprose asynchronous client & standalone server based on swoole

Hprose for Swoole Introduction Hprose is a High Performance Remote Object Service Engine. It is a modern, lightweight, cross-language, cross-platform,

This package provides a high performance HTTP server to speed up your Laravel/Lumen application based on Swoole.
This package provides a high performance HTTP server to speed up your Laravel/Lumen application based on Swoole.

This package provides a high performance HTTP server to speed up your Laravel/Lumen application based on Swoole.

PHP Kafka client is used in PHP-FPM and Swoole. PHP Kafka client supports 50 APIs, which might be one that supports the most message types ever.

longlang/phpkafka Introduction English | 简体中文 PHP Kafka client is used in PHP-FPM and Swoole. The communication protocol is based on the JSON file in

LaravelS is an out-of-the-box adapter between Swoole and Laravel/Lumen.
LaravelS is an out-of-the-box adapter between Swoole and Laravel/Lumen.

🚀 LaravelS is an out-of-the-box adapter between Swoole and Laravel/Lumen.

一个极简高性能php框架,支持[swoole | php-fpm ]环境

One - 一个极简高性能php框架,支持[swoole | php-fpm ]环境 快 - 即使在php-fpm下也能1ms内响应请求 简单 - 让你重点关心用one做什么,而不是怎么用one 灵活 - 各个组件松耦合,可以灵活搭配使用,使用方法保持一致 原生sql可以和模型关系with搭配使用,

球球大作战(PHP+Swoole)
球球大作战(PHP+Swoole)

球球大作战 在线多人H5游戏(H5客户端, 服务端) W A S D 控制 技术栈: PHP7.4+ Swoole4.6(多进程, WebSocket, 共享内存) SpriteJS v3(2D Canvas渲染) 演示Demo 安装: 环境要求:Linux,PHP7.4+(启用Swoole拓展)

🚀 Developing Rocketseat's Next Level Week (NLW#05) Application using PHP/Swoole + Hyperf

Inmana PHP 🚀 Developing Rocketseat 's Next Level Week (NLW#05) Application using Swoole + Hyperf. This is the app of the Elixir track. I know PHP/Swo

Redis watcher for PHP-Casbin in Swoole.

Redis watcher for PHP-Casbin in Swoole Redis watcher for PHP-Casbin in Swoole , Casbin is a powerful and efficient open-source access control library.

DoraRPC is an RPC For the PHP MicroService by The Swoole

Dora RPC 简介(Introduction) Dora RPC 是一款基础于Swoole定长包头通讯协议的最精简的RPC, 用于复杂项目前后端分离,分离后项目都通过API工作可更好的跟踪、升级、维护及管理。 问题提交: Issue For complex projects separation

Owner
Adem Ali Durmuş
Adem Ali Durmuş
A easy way to install your basic yii projetc, we have encrypt database password in phpfile, my class with alot funtions to help you encrypt and decrypt and our swoole server install just run ./yii swoole/start and be happy!

Yii 2 Basic Project Template with swoole and Modules Yii 2 Basic Project Template is a skeleton Yii 2 application best for rapidly creating small proj

null 3 Apr 11, 2022
Multi-process coroutine edition Swoole spider !! Learn about Swoole's network programming and the use of its related APIs

swoole_spider php bin/spider // Just do it !! Cache use Swoole\Table; use App\Table\Cache; $table = new Table(1<<20); // capacity size $table->column

null 3 Apr 22, 2021
swoole and golang ipc, use goroutine complete swoole coroutine

swoole and golang ipc demo swoole process module exec go excutable file as sider car, use goroutine complete swoole coroutine hub.php <?php require '

null 2 Apr 17, 2022
swoole,easyswoole,swoole framework

EasySwoole - A High Performance Swoole Framework EasySwoole is a distributed, persistent memory PHP framework based on the Swoole extension. It was cr

null 4.6k Jan 2, 2023
Simple WebSocket server implemented in PHP.

Bloatless PHP WebSockets Simple WebSocket server implemented in PHP. Installation Requirements Installation procedure Usage Server Applications Timers

bloatless.org 556 Dec 25, 2022
A sample CakePHP api application using CakeDC/cakephp-api and swoole as server

CakePHP Application Skeleton composer create-project --prefer-dist cakephp/app Added sample data using https://github.com/annexare/Countries Created m

Marcelo Rocha 3 Jul 28, 2022
PHP Websocket Server that is compatible with socket.io

PHP SocketIO Server PHP Websocket Server that is compatible with socket.io So far the function use in this package is almost same with the naming in s

Cydrick Nonog 7 Dec 21, 2022
A pocketmine-mp server that we develop live on Twitch every Saturday from 8pm to 10pm (FR)

Server A pocketmine-mp server that we develop live on Twitch every Saturday from 8pm to 10pm (FR) Contributing Pull requests are welcome. For major ch

Gaëtan H 11 Oct 9, 2022
Socks5 proxy server written in Swoole PHP

php-socks This is a Socks5 proxy server implementation built with PHP & Swoole. To start the proxy server, clone this repo, run composer install to in

Nazmul Alam 3 Jan 23, 2022
An asynchronous event driven PHP socket framework. Supports HTTP, Websocket, SSL and other custom protocols. PHP>=5.3.

Workerman What is it Workerman is an asynchronous event-driven PHP framework with high performance to build fast and scalable network applications. Wo

walkor 10.2k Dec 31, 2022