You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: README.MD
+31-41Lines changed: 31 additions & 41 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -1,9 +1,3 @@
1
-
<!-- personal notes
2
-
3
-
-------
4
-
5
-
-->
6
-
7
1
# Long Polling Server
8
2
9
3
A simple [long-polling](https://javascript.info/long-polling) server (and client) written in Lua.
@@ -12,15 +6,6 @@ A simple [long-polling](https://javascript.info/long-polling) server (and client
12
6
13
7
_source: javascript.info_
14
8
15
-
## Features:
16
-
17
-
- Can be used to deliver messages to multiple clients at the same time.
18
-
- Tested in a production environment
19
-
- docker ready
20
-
- Contains Client and Server components. Also contains advanced application example
21
-
- You can specify predefined parameters to be added to each update object, which is useful when you want to recognize different services that send updates to the same link.
22
-
- Ability to customize the amount of data stored and the storage time (for redis) so that no garbage is stored
23
-
24
9
## Use cases:
25
10
26
11
- 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
@@ -30,36 +15,41 @@ _source: javascript.info_
30
15
## Project structure
31
16
32
17
```
33
-
.
34
-
├── lua
35
-
│ └── long-polling
36
-
│ ├── application
37
-
│ │ ├── docker-compose.yml
38
-
│ │ ├── Dockerfile
39
-
│ │ ├── init.lua
40
-
│ │ └── README.MD
41
-
│ ├── client
42
-
│ │ ├── init.lua
43
-
│ │ └── README.MD
44
-
│ └── server
45
-
│ ├── dataproviders
46
-
│ │ ├── localtable.lua
47
-
│ │ └── redis.lua
48
-
│ ├── misc
49
-
│ │ ├── pubsub.lua
50
-
│ │ └── redis-safe.lua
51
-
│ ├── init.lua
52
-
│ └── README.MD
53
-
├── LICENSE
54
-
└── README.MD
18
+
│ .
19
+
├── examples
20
+
│ ├── advanced
21
+
│ │ ├── client.lua
22
+
│ │ ├── docker-compose.yml
23
+
│ │ ├── Dockerfile
24
+
│ │ ├── README.MD
25
+
│ │ └── server.lua
26
+
│ └── simple
27
+
│ ├── README.MD
28
+
│ └── server.lua
29
+
├── lua
30
+
│ └── long-polling
31
+
│ ├── dataproviders
32
+
│ │ ├── localtable.lua
33
+
│ │└── redis.lua
34
+
│ ├── misc
35
+
│ │ ├── pubsub.lua
36
+
│ │└── redis-safe.lua
37
+
│ └── init.lua
38
+
├── LICENSE
39
+
└── README.MD
55
40
56
41
```
57
42
58
-
## Usage:
43
+
## Documentation:
44
+
45
+
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 ⚡.
46
+
47
+
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.
48
+
49
+
## Application examples:
59
50
60
-
- 🔥 [application](/lua/long-polling/application)
61
-
-[client](/lua/long-polling/client)
62
-
-[server](/lua/long-polling/server)
51
+
- 🔥 [advanced](/examples/advanced). Source code of real-working application
52
+
-[simple](/examples/simple). Simple to understand example of using the library
Copy file name to clipboardExpand all lines: examples/advanced/README.MD
+27-18Lines changed: 27 additions & 18 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -1,15 +1,24 @@
1
-
# Long Polling Application
1
+
# Long Polling Server Application
2
2
3
-
> 🇺🇸 English version not ready for now (I am lazy and don't want to translate it). You can use https://www.deepl.com/ to translate text on your own.
3
+
In this folder you can find the source code of the server and client, which works at `poll.def.pm`.
4
+
5
+
## Features
6
+
7
+
- Can be used to deliver messages to multiple clients at the same time.
8
+
- Tested in a production environment
9
+
- docker ready
10
+
- You can specify predefined parameters to be added to each update object, which is useful when you want to recognize different services that send updates to the same link.
11
+
- Ability to customize the amount of data stored and the storage time (for redis) so that no garbage is stored
4
12
5
-
В папке находится исходный код поллинг клиента и сервера, который работает по адресу `poll.def.pm`.
6
13
7
-
## Run advanced application
14
+
## Run the application
8
15
9
16
```bash
10
-
cd directory_with_this_file/
17
+
# git clone this repo
18
+
# cd directory_with_this_file/
11
19
12
20
# run server via docker-compose.yml (will build fresh image)
21
+
# 👍 nice for development
13
22
docker-compose up --build polling
14
23
15
24
# alternatively run server via docker run (will use image from registry)
@@ -32,36 +41,36 @@ No authorization. With API features in mind, you can use your server as a public
32
41
33
42
**👀 Test server:** poll.def.pm. But please, don't use it in production because I can turn it off at any moment.
34
43
35
-
#Lua Long Polling Client Example
44
+
##Client Example
36
45
37
46
> 🇺🇸 English version not ready for now (I am lazy and don't want to translate it). You can use https://www.deepl.com/ to translate text on your own.
38
47
39
-
Работает как в чистом Lua, так и на Garry's Mod сервере.
48
+
Works both in pure Lua and on Garry's Mod server.
40
49
41
-
На чистом Lua требует copas (а он luasocket), lua-requests-async (он тоже требует copas) и cjson.
50
+
On pure Lua requires copas (and luasocket), lua-requests-async (it also requires copas) and cjson.
42
51
43
-
##Использование
52
+
### Usage
44
53
45
-
**В гмоде**закинуть по любому пути, потом получить доступ к библиотеке через `kupol = include("path/to/client.lua")`. Автоматически в глобальное пространство ничего не добавляется.
54
+
**In gmod**put any file in the path, then get access to the library through `kupol = include("path/to/client.lua")`. Nothing is added to the global space automatically.
46
55
47
-
В чистом Lua можно использовать`kupol = require("long-polling.client")`.
56
+
In pure Lua you can use`kupol = require("long-polling.client")`.
48
57
49
-
##Пример
58
+
### Example
50
59
51
60
```lua
52
61
localkupol=require("long-polling.client") -- also works in Garry's Mod with include()
0 commit comments