User Tools

Site Tools


dev:websockets:gateway:websocketd

Differences

This shows you the differences between two versions of the page.

Link to this comparison view

Both sides previous revisionPrevious revision
Next revision
Previous revision
dev:websockets:gateway:websocketd [2018/06/11 14:48] – [Quick Setup Guide for NGINX Users] ericksondev: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 45: Line 46:
 </code> </code>
  
-==== Run Websocketd on port 7684 ====+==== Run Websocketd on port 7682 ====
  
 <code> <code>
 +# Stop apache-websockets first since we're reusing the port.
 +sudo systemctl stop apache2-websockets # or similar
 +
 # AS USER opensrf # AS USER opensrf
-/usr/local/bin/websocketd --loglevel info --maxforks 250 --port 7684 /openils/bin/osrf-websocket-stdio+/usr/local/bin/websocketd --loglevel info --maxforks 250 --port 7682 /openils/bin/osrf-websocket-stdio
  
 # Or optionally override the config file path # Or optionally override the config file path
-/usr/local/bin/websocketd --loglevel info --maxforks 250 --port 7684 /openils/bin/osrf-websocket-stdio /path/to/opensrf_core.xml+/usr/local/bin/websocketd --loglevel info --maxforks 250 --port 7682 /openils/bin/osrf-websocket-stdio /path/to/opensrf_core.xml
  
 # Optionally background the process with a trailing '&' # Optionally background the process with a trailing '&'
 </code> </code>
  
 +Full set of command line args at https://github.com/joewalnes/websocketd/blob/master/help.go
 ==== Modify NGINX to proxy websocketd ==== ==== Modify NGINX to proxy websocketd ====
  
Line 63: Line 68:
 <code> <code>
  
-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 https://localhost:7682;+Replace https:// with http:// 
 +proxy_pass http://localhost:7682;
  
-I run websocketd in non-SSL mode behind the proxy  +Update timeout values within the /osrf-websocket-translator section  
-proxy_pass http://localhost:7684; +# to disconnect idle clients.
- +
-Update timeout values to disconnect idle clients.+
 # 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://github.com/joewalnes/websocketd/issues/300|not yet anyway]]).  Systemd to the rescue.
 +
 +Put this content into file /lib/systemd/system/websocketd-osrf.service
 +
 +<code>
 +[Unit]
 +Description=Websocketd OpenSRF Gateway
 +
 +[Service]
 +Type=simple
 +User=opensrf
 +Group=opensrf
 +Environment=PATH=/openils/bin:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin
 +Environment=LD_LIBRARY_PATH=/openils/lib:/usr/local/lib:/usr/local/lib/dbd:$LD_LIBRARY_PATH
 +ExecStart=/usr/local/bin/websocketd --loglevel error --maxforks 250 --port 7682 /openils/bin/osrf-websocket-stdio
 +
 +# modify websocketd command line options to taste
 +# --sameorigin and --origin=domain1,domain2 flags are also supported for security.
 +
 +# On Ubuntu 18.04, you may also need to include something like this:
 +[Install]
 +WantedBy=multi-user.target
 +</code>
 +
 +Then add & start the service.
 +
 +<code>
 +# 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
 +</code>
  
  
dev/websockets/gateway/websocketd.1528742903.txt.gz · Last modified: 2022/02/10 13:34 (external edit)

Except where otherwise noted, content on this wiki is licensed under the following license: CC Attribution-Share Alike 4.0 International
CC Attribution-Share Alike 4.0 International Donate Powered by PHP Valid HTML5 Valid CSS Driven by DokuWiki

© 2008-2022 GPLS and others. Evergreen is open source software, freely licensed under GNU GPLv2 or later.
The Evergreen Project is a U.S. 501(c)3 non-profit organization.