dev:websockets:gateway:websocketd
Differences
This shows you the differences between two versions of the page.
Both sides previous revisionPrevious revisionNext revision | Previous revision | ||
dev:websockets:gateway:websocketd [2018/06/11 14:47] – [Why?] erickson | dev:websockets:gateway:websocketd [2022/02/10 13:34] (current) – external edit 127.0.0.1 | ||
---|---|---|---|
Line 20: | Line 20: | ||
* Speed is consistent with Apache (within fractions of milliseconds) | * Speed is consistent with Apache (within fractions of milliseconds) | ||
* Websocketd project has a lot more activity and contributors than the apache-websocket code we're currently using. | * Websocketd project has a lot more activity and contributors than the apache-websocket code we're currently using. | ||
+ | * fewer steps to set up | ||
===== Concerns? ===== | ===== Concerns? ===== | ||
Line 28: | Line 29: | ||
===== Quick Setup Guide for NGINX Users ===== | ===== Quick Setup Guide for NGINX Users ===== | ||
- | **Note a proxy is not required, because websocketd supports SSL connections, | + | **Note |
==== Install OpenSRF Branch ==== | ==== Install OpenSRF Branch ==== | ||
Line 45: | Line 46: | ||
</ | </ | ||
- | ==== Run Websocketd on port 7684 ==== | + | ==== Run Websocketd on port 7682 ==== |
< | < | ||
+ | # Stop apache-websockets first since we're reusing the port. | ||
+ | sudo systemctl stop apache2-websockets # or similar | ||
+ | |||
# AS USER opensrf | # AS USER opensrf | ||
- | / | + | / |
# Or optionally override the config file path | # Or optionally override the config file path | ||
- | / | + | / |
# Optionally background the process with a trailing '&' | # Optionally background the process with a trailing '&' | ||
</ | </ | ||
+ | Full set of command line args at https:// | ||
==== Modify NGINX to proxy websocketd ==== | ==== Modify NGINX to proxy websocketd ==== | ||
Line 63: | Line 68: | ||
< | < | ||
- | # comment out the apache-websocket proxy. | + | # Websocketd supports SSL, but I run it in non-SSL mode since it's on the same machine as NGINX. |
- | # proxy_pass | + | # Replace |
+ | proxy_pass http:// | ||
- | # I run websocketd in non-SSL mode behind | + | # Update timeout values within |
- | proxy_pass http:// | + | # to disconnect idle clients. |
- | + | ||
- | # Update timeout values | + | |
# The osrf-websocket-stdio handler has no idle timeout threads. | # The osrf-websocket-stdio handler has no idle timeout threads. | ||
# Change to suit | # Change to suit | ||
Line 107: | Line 111: | ||
Log in to the browser client as usual. | Log in to the browser client as usual. | ||
+ | ==== Optional Systemd Setup ==== | ||
+ | |||
+ | Websocketd is a standalone program with no daemon mode ([[https:// | ||
+ | |||
+ | Put this content into file / | ||
+ | |||
+ | < | ||
+ | [Unit] | ||
+ | Description=Websocketd OpenSRF Gateway | ||
+ | |||
+ | [Service] | ||
+ | Type=simple | ||
+ | User=opensrf | ||
+ | Group=opensrf | ||
+ | Environment=PATH=/ | ||
+ | Environment=LD_LIBRARY_PATH=/ | ||
+ | ExecStart=/ | ||
+ | |||
+ | # modify websocketd command line options to taste | ||
+ | # --sameorigin and --origin=domain1, | ||
+ | |||
+ | # On Ubuntu 18.04, you may also need to include something like this: | ||
+ | [Install] | ||
+ | WantedBy=multi-user.target | ||
+ | </ | ||
+ | |||
+ | Then add & start the service. | ||
+ | |||
+ | < | ||
+ | # disable apache2-websockets to avoid unintended starts & port conflicts | ||
+ | sudo systemctl disable apache2-websockets | ||
+ | |||
+ | # enable and start websocketd-osrf | ||
+ | sudo systemctl daemon-reload | ||
+ | sudo systemctl enable websocketd-osrf | ||
+ | sudo systemctl start websocketd-osrf | ||
+ | </ | ||
dev/websockets/gateway/websocketd.1528742836.txt.gz · Last modified: 2022/02/10 13:34 (external edit)