1738
|
1 local Io = require "luan:Io.luan"
|
|
2 local Http = require "luan:http/Http.luan"
|
|
3 local Logging = require "luan:logging/Logging.luan"
|
|
4 local logger = Logging.logger "init"
|
|
5
|
|
6
|
|
7 return function()
|
|
8 local request = Http.request
|
|
9 local message = request.parameters.message
|
|
10 if message ~= nil then
|
|
11 local url = request.url()
|
|
12 Http.push(url,message)
|
|
13 end
|
|
14 Io.stdout = Http.response.text_writer()
|
|
15 %>
|
|
16 <!doctype html>
|
|
17 <html>
|
|
18 <body>
|
|
19 <h1>push server-sent events</h1>
|
|
20 <form method=post>
|
|
21 <p><textarea name=message></textarea></p>
|
|
22 <p><input type=submit></p>
|
|
23 </form>
|
|
24 </body>
|
|
25 </html>
|
|
26 <%
|
|
27 end
|