I use wscat from a bash script for connecting to a websocket endpoint in a web application with success.
#!/bin/bash
...
wscat -n -c wss://myappserver:2443/mywebapp/websocket/myendpoint?param1=x
...
When I call the same script from a ubuntu systemd service unit with the same user, wscat gives me an error:
"error: WebSocket was closed before the connection was established"
[Unit]
Description=My websocket service
[Service]
Type=simple
User=cloudbox
WorkingDirectory=/opt/mycompany/my-app
ExecStart=/bin/bash --verbose -c /opt/mycompany/my-app/my_websocket_script.sh
Restart=always
RestartSec=10
TimeoutStartSec=90
[Install]
WantedBy=multi-user.target
What can I do?