Software / code / prosody
Comparison
plugins/mod_websocket.lua @ 9378:a6f54df39624
mod_websocket: Serve HTTP in global context
| author | Kim Alvefur <zash@zash.se> |
|---|---|
| date | Sat, 22 Sep 2018 00:02:16 +0200 |
| parent | 8794:0e2c1c4d4f78 |
| child | 9415:02155a10c5e9 |
comparison
equal
deleted
inserted
replaced
| 9377:f2013233e20d | 9378:a6f54df39624 |
|---|---|
| 313 end | 313 end |
| 314 end | 314 end |
| 315 | 315 |
| 316 module:hook("c2s-read-timeout", keepalive, -0.9); | 316 module:hook("c2s-read-timeout", keepalive, -0.9); |
| 317 | 317 |
| 318 module:depends("http"); | |
| 319 module:provides("http", { | |
| 320 name = "websocket"; | |
| 321 default_path = "xmpp-websocket"; | |
| 322 route = { | |
| 323 ["GET"] = handle_request; | |
| 324 ["GET /"] = handle_request; | |
| 325 }; | |
| 326 }); | |
| 327 | |
| 318 function module.add_host(module) | 328 function module.add_host(module) |
| 319 module:depends("http"); | |
| 320 module:provides("http", { | |
| 321 name = "websocket"; | |
| 322 default_path = "xmpp-websocket"; | |
| 323 route = { | |
| 324 ["GET"] = handle_request; | |
| 325 ["GET /"] = handle_request; | |
| 326 }; | |
| 327 }); | |
| 328 module:hook("c2s-read-timeout", keepalive, -0.9); | 329 module:hook("c2s-read-timeout", keepalive, -0.9); |
| 329 | 330 |
| 330 if cross_domain ~= true then | 331 if cross_domain ~= true then |
| 331 local url = require "socket.url"; | 332 local url = require "socket.url"; |
| 332 local ws_url = module:http_url("websocket", "xmpp-websocket"); | 333 local ws_url = module:http_url("websocket", "xmpp-websocket"); |