mod_websocket
WebSockets is a protocol for providing web pages with simple two-way communication with a web server. This module allows browsers to communicate with Prosody via XMPP over WebSockets. This usually induces less overhead than using BOSH.
There are many JavaScript XMPP libraries capable of utilizing WebSockets, among them:
Usage
= {
modules_enabled -- Other modules
"websocket"; -- Enable mod_websocket
}
To allow requests that would normally break the Same-Origin policy, the cross_domain_websocket
option can be used. Set it to true
to enable cross-domain requests from all websites, or specify a list:
= { "http://jabber.org", "http://prosody.im" } cross_domain_websocket
If encryption is provided by a HTTP proxy, Prosody won’t be able to see this, and consider the connection insecure (consequently forbidding some authentication mechanisms). In this case Prosody can be told to always consider WebSocket connections secure by setting in the global section.
= true consider_websocket_secure
The WebSocket endpoint will be at wss:example.com:5281/xmpp-websocket
and ws:example.com:5280/xmpp-websocket
by default, see HTTP path configuration if you would like to change this.
Configuration
Option | Type | Default |
---|---|---|
c2s_close_timeout |
number | 5 |
consider_websocket_secure |
boolean | empty |
cross_domain_websocket |
set | { "https://example.com" } 1 |
Uses the
http_host
setting on the current VirtualHost↩︎