1
0
Fork 0
mirror of https://github.com/processone/ejabberd synced 2025-10-04 02:09:33 +02:00

Add WebSockets support to mod_mqtt

Example configuration:

listen:
  ...
  -
    port: 5280
    module: ejabberd_http
    request_handlers:
      "/mqtt": mod_mqtt

modules:
  ...
  mod_mqtt: {}
This commit is contained in:
Evgeny Khramtsov 2019-04-23 19:18:22 +03:00
parent d2ea905926
commit edba1aebb5
3 changed files with 178 additions and 2 deletions

View file

@ -27,6 +27,8 @@
terminate/2, code_change/3]).
%% ejabberd_listener API
-export([start/3, start_link/3, listen_opt_type/1, listen_options/0, accept/1]).
%% ejabberd_http API
-export([socket_handoff/3]).
%% Legacy ejabberd_listener API
-export([become_controller/2, socket_type/0]).
%% API
@ -98,6 +100,9 @@ become_controller(Pid, _) ->
accept(Pid) ->
mod_mqtt_session:accept(Pid).
socket_handoff(LocalPath, Request, Opts) ->
mod_mqtt_ws:socket_handoff(LocalPath, Request, Opts).
open_session({U, S, R}) ->
Mod = gen_mod:ram_db_mod(S, ?MODULE),
Mod:open_session({U, S, R}).