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