-
Notifications
You must be signed in to change notification settings - Fork 123
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Updating websockets example and readme
- Loading branch information
Showing
5 changed files
with
48 additions
and
2 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,27 @@ | ||
# Websocket Service | ||
|
||
## Setup | ||
|
||
```shell | ||
script/setup --websockets | ||
``` | ||
|
||
## Quick Start | ||
|
||
In one terminal, run the following | ||
|
||
```shell | ||
script/run_websockets --uri 'tcp://0.0.0.0:10701' --websocket-host '0.0.0.0' | ||
``` | ||
|
||
This will spawn a Wyoming server that listens to and then subsequently publishes events to the provided websocket host and port | ||
|
||
```shell | ||
script/run --name 'my satellite' --uri 'tcp://0.0.0.0:10700' --mic-command 'arecord -r 16000 -c 1 -f S16_LE -t raw' --snd-command 'aplay -r 22050 -c 1 -f S16_LE -t raw' --event-uri 'tcp://0.0.0.0:10701' | ||
``` | ||
|
||
In another terminal, run the above. This will start the actual satellite and publish events to the Wyoming server in Terminal 1. | ||
|
||
If you open the `timers.html` file in a browser, in the Network tab of the Dev Tools, you should see it connect to the websocket. | ||
|
||
Alternatively, if you have another app that uses websockets, you should be able to connect to that as well now |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
File renamed without changes.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,12 @@ | ||
#!/usr/bin/env python3 | ||
import sys | ||
import subprocess | ||
import venv | ||
from pathlib import Path | ||
|
||
_DIR = Path(__file__).parent | ||
_PROGRAM_DIR = _DIR.parent | ||
_VENV_DIR = _PROGRAM_DIR / ".venv" | ||
|
||
context = venv.EnvBuilder().ensure_directories(_VENV_DIR) | ||
subprocess.check_call([context.env_exe, "examples/websocket-service/server.py"] + sys.argv[1:]) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters