Comparison

plugins/mod_websocket.lua @ 7944:36a9a4af1873

Merge 0.10->trunk
author Kim Alvefur <zash@zash.se>
date Thu, 02 Mar 2017 23:03:02 +0100
parent 7938:3629f03817f8
child 8052:f83a2d4826fb
comparison
equal deleted inserted replaced
7923:81f3068fc30c 7944:36a9a4af1873
49 module:depends("c2s") 49 module:depends("c2s")
50 local sessions = module:shared("c2s/sessions"); 50 local sessions = module:shared("c2s/sessions");
51 local c2s_listener = portmanager.get_service("c2s").listener; 51 local c2s_listener = portmanager.get_service("c2s").listener;
52 52
53 --- Session methods 53 --- Session methods
54 local function session_open_stream(session) 54 local function session_open_stream(session, from, to)
55 local attr = { 55 local attr = {
56 xmlns = xmlns_framing, 56 xmlns = xmlns_framing,
57 ["xml:lang"] = "en",
57 version = "1.0", 58 version = "1.0",
58 id = session.streamid or "", 59 id = session.streamid or "",
59 from = session.host 60 from = from or session.host, to = to,
60 }; 61 };
62 if session.stream_attrs then
63 session:stream_attrs(from, to, attr)
64 end
61 session.send(st.stanza("open", attr)); 65 session.send(st.stanza("open", attr));
62 end 66 end
63 67
64 local function session_close(session, reason) 68 local function session_close(session, reason)
65 local log = session.log or log; 69 local log = session.log or log;