Software /
code /
prosody
Diff
plugins/mod_websocket.lua @ 10728:2764beb552cd
mod_bosh, mod_websocket: Add config options to override GET responses
author | Matthew Wild <mwild1@gmail.com> |
---|---|
date | Mon, 20 Apr 2020 11:30:59 +0100 |
parent | 10617:8941bebd64e4 |
child | 11114:6a608ecb3471 |
line wrap: on
line diff
--- a/plugins/mod_websocket.lua Sun Apr 19 13:04:12 2020 +0200 +++ b/plugins/mod_websocket.lua Mon Apr 20 11:30:59 2020 +0100 @@ -130,6 +130,12 @@ return data; end + +local default_get_response_body = [[<!DOCTYPE html><html><head><title>Websocket</title></head><body> +<p>It works! Now point your WebSocket client to this URL to connect to Prosody.</p> +</body></html>]] +local websocket_get_response_body = module:get_option_string("websocket_get_response_body", default_get_response_body) + function handle_request(event) local request, response = event.request, event.response; local conn = response.conn; @@ -138,9 +144,7 @@ if not request.headers.sec_websocket_key or request.method ~= "GET" then response.headers.content_type = "text/html"; - return [[<!DOCTYPE html><html><head><title>Websocket</title></head><body> - <p>It works! Now point your WebSocket client to this URL to connect to Prosody.</p> - </body></html>]]; + return websocket_get_response_body; end local wants_xmpp = contains_token(request.headers.sec_websocket_protocol or "", "xmpp");