Skip to content

TRIGONIM/lua-long-polling

Folders and files

NameName
Last commit message
Last commit date

Latest commit

Β 

History

37 Commits
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 

Repository files navigation

Long Polling Server

A simple long-polling server (and client) written in Lua.

demo image

source: javascript.info

Use cases:

  • In environments where it is not possible to create a web server (e.g. in a Garry's Mod game), but getting "webhooks" is necessary
  • As a single point of collecting webhooks, for example to get updates from all your Telegram bots with just one request. To do this, make https://api.telegram.org/bot$TOKEN/setWebhook?url=https://your.app/SomeS3cretP@th?this_key=and_value&will_be=merged_with_updates_sent_by_telegram&botname=some_id.
  • Simple chat-like services implementations

Project structure

β”‚ .
β”œβ”€β”€ examples
β”‚   β”œβ”€β”€ advanced
β”‚   β”‚   β”œβ”€β”€ client.lua
β”‚   β”‚   β”œβ”€β”€ docker-compose.yml
β”‚   β”‚   β”œβ”€β”€ Dockerfile
β”‚   β”‚   β”œβ”€β”€ README.MD
β”‚   β”‚   └── server.lua
β”‚   └── simple
β”‚       β”œβ”€β”€ README.MD
β”‚       └── server.lua
β”œβ”€β”€ lua
β”‚   └── long-polling
β”‚       β”œβ”€β”€ dataproviders
β”‚       β”‚   β”œβ”€β”€ localtable.lua
β”‚       β”‚   └── redis.lua
β”‚       β”œβ”€β”€ misc
β”‚       β”‚   └── redis-safe.lua
β”‚       └── init.lua
β”œβ”€β”€ LICENSE
└── README.MD

Documentation:

Not ready yet. I am lazy. But if you create an issue so I can see that someone needs it, I will create code documentation instantly ⚑.

But you can look at the examples below to understand what is what. Also, in the examples there are README files with a lot of useful information.

Application examples:

  • πŸ”₯ advanced. Source code of real-working application
  • simple. Simple to understand example of using the library

TODO:

  • Move out redis-safe into separate repo
  • Split the library and application examples into separate repos. Need for the ability to do require("kupol.server") and require("kupol.client")
  • Create the mysql dataprovider, using luasocket-mysql driver
  • Also create the filesystem dataprovider