Mercurial > prosody-modules
comparison mod_websocket/mod_websocket.lua @ 688:e87678a52720
mod_websocket: Make this a shared module
author | Florian Zeitz <florob@babelmonkeys.de> |
---|---|
date | Sun, 27 May 2012 17:17:52 +0200 |
parents | d141375ece4b |
children | 4d21bd5dde49 |
comparison
equal
deleted
inserted
replaced
687:d141375ece4b | 688:e87678a52720 |
---|---|
19 local sha1 = require "util.hashes".sha1; | 19 local sha1 = require "util.hashes".sha1; |
20 local base64 = require "util.encodings".base64.encode; | 20 local base64 = require "util.encodings".base64.encode; |
21 local band = require "bit".band; | 21 local band = require "bit".band; |
22 local bxor = require "bit".bxor; | 22 local bxor = require "bit".bxor; |
23 local tohex = require "bit".tohex; | 23 local tohex = require "bit".tohex; |
24 | |
25 module:depends("http") | |
26 | |
27 | 24 |
28 local xpcall, tostring, type = xpcall, tostring, type; | 25 local xpcall, tostring, type = xpcall, tostring, type; |
29 local traceback = debug.traceback; | 26 local traceback = debug.traceback; |
30 | 27 |
31 local xmlns_xmpp_streams = "urn:ietf:params:xml:ns:xmpp-streams"; | 28 local xmlns_xmpp_streams = "urn:ietf:params:xml:ns:xmpp-streams"; |
328 response.headers.Sec_WebSocket_Protocol = "xmpp"; | 325 response.headers.Sec_WebSocket_Protocol = "xmpp"; |
329 | 326 |
330 return ""; | 327 return ""; |
331 end | 328 end |
332 | 329 |
333 function module.load() | 330 function module.add_host(module) |
331 module:depends("http"); | |
334 module:provides("http", { | 332 module:provides("http", { |
335 name = "xmpp-websocket"; | 333 name = "xmpp-websocket"; |
336 route = { | 334 route = { |
337 ["GET /*"] = handle_request; | 335 ["GET /*"] = handle_request; |
338 }; | 336 }; |