Command line arguments when launching server
--serve ws://0.0.0.0:8081
the address to start the server.ws://
andwss://
are supported--cert --ca --pkey
file path of wss, must be provided when protocol iswss://
--file-root
specify the root of files for reading, default is.
(current directory)
$ wssvc --serve ws://:8888 --file-root /tmp
Server String
ws://:8080
is same asws://0.0.0.0:8080
, which listens on*.*:8080
or say0.0.0.0:8080
, which allows connection to TCP 8080 port from anywhere.ws://localhost:8080
is same asws://127.0.0.1:8080
, which listens on127.0.0.1:8080
, which allows connection to TCP 8080 port from local host. Connections from locations other than localhost is not permitted.wss://
has the same behavior withws://
Client side can control server side behavior using the following commands by sending text messages
ping me
asking server to send a Ping message to clientpong me
asking server to send a Pong message to clientdisconnect me
asking server to send a Close message to clientstart ping me
asking server to start to ping client forever every a few secondsstop ping me
asking server to stop to ping clientsend me file://test.docx
asking server to send a file under fileroot to client