Added HTML and nginx.conf examples.
authorStanislaw Klekot <dozzie@jarowit.net>
Sun, 19 Apr 2015 17:19:45 +0000 (19:19 +0200)
committerStanislaw Klekot <dozzie@jarowit.net>
Sun, 19 Apr 2015 17:19:45 +0000 (19:19 +0200)
examples/example_html.erl
examples/example_nginx.erl

index 8fe8582..4dc642f 100644 (file)
@@ -2,6 +2,39 @@
 %%% @doc
 %%%   Example HTML to check Server-Sent Events in the browser.
 %%%
+%```
+%<html>
+%<head>
+%<title>server-sent events test</title>
+%<meta http-equiv="content-type" content="text/html; charset=utf-8" />
+%<style>
+%
+%pre {
+%  border: solid 1px black;
+%}
+%
+%</style>
+%<script>
+%
+%  var es = new EventSource("/events");
+%
+%  es.onmessage = function(e) {
+%    var logs = document.getElementById("logs");
+%    logs.textContent += e.data + "\n";
+%  };
+%
+%</script>
+%</head>
+%<body>
+%
+%<h1>Test of server-sent events</h1>
+%
+%<pre id="logs">
+%</pre>
+%
+%</body>
+%</html>
+%'''
 %%% @end
 %%%---------------------------------------------------------------------------
 
index e27c5ff..7735a07 100644 (file)
@@ -2,6 +2,25 @@
 %%% @doc
 %%%   Example config for nginx.
 %%%
+%```
+%server {
+%  # ...
+%
+%  location / {
+%    proxy_pass http://127.0.0.1:1080/;
+%  }
+%
+%  location /events {
+%    proxy_pass http://127.0.0.1:1080/events;
+%    proxy_buffering off;
+%    proxy_cache off;
+%    proxy_http_version 1.1;
+%    chunked_transfer_encoding off;
+%  }
+%
+%  # ...
+%}
+%'''
 %%% @end
 %%%---------------------------------------------------------------------------