Skip to content

Commit

Permalink
feat: add thunder client
Browse files Browse the repository at this point in the history
- add thunder client to dev container
- begin adding development only websocket endpoint
  • Loading branch information
ZanzyTHEbar committed Mar 26, 2023
1 parent 9d27b94 commit 637434b
Show file tree
Hide file tree
Showing 2 changed files with 82 additions and 61 deletions.
91 changes: 46 additions & 45 deletions .devcontainer/devcontainer.json
Original file line number Diff line number Diff line change
@@ -1,46 +1,47 @@
// For format details, see https://aka.ms/devcontainer.json. For config options, see the
// README at: https://github.com/devcontainers/templates/tree/main/src/docker-existing-dockerfile
{
"name": "EyeTrackVR App Backend",
"build": {
// Sets the run context to one level up instead of the .devcontainer folder.
"context": "..",
// Update the 'dockerFile' property if you aren't using the standard 'Dockerfile' filename.
"dockerfile": "../Dockerfile"
},
"features": {
"ghcr.io/akhildevelops/devcontainer-features/apt:0": {},
"ghcr.io/devcontainers/features/python:1": {
"installTools": true,
"optimize": true,
"version": "3.11"
}
},
"customizations": {
"vscode": {
"settings": {},
"extensions": [
"streetsidesoftware.code-spell-checker",
"ms-python.python",
"ms-python.vscode-pylance",
"ms-azuretools.vscode-docker",
"wayou.vscode-todo-highlight",
"gruntfuggly.todo-tree",
"eamodio.gitlens",
"github.vscode-pull-request-github"
]
}
},
// Features to add to the dev container. More info: https://containers.dev/features.
// "features": {},
// Use 'forwardPorts' to make a list of ports inside the container available locally.
"forwardPorts": [
8000
],
// Uncomment the next line to run commands after the container is created.
"postCreateCommand": "make install && make"
// Configure tool-specific properties.
// "customizations": {},
// Uncomment to connect as an existing user other than the container default. More info: https://aka.ms/dev-containers-non-root.
// "remoteUser": "devcontainer"
// For format details, see https://aka.ms/devcontainer.json. For config options, see the
// README at: https://github.com/devcontainers/templates/tree/main/src/docker-existing-dockerfile
{
"name": "EyeTrackVR App Backend",
"build": {
// Sets the run context to one level up instead of the .devcontainer folder.
"context": "..",
// Update the 'dockerFile' property if you aren't using the standard 'Dockerfile' filename.
"dockerfile": "../Dockerfile"
},
"features": {
"ghcr.io/akhildevelops/devcontainer-features/apt:0": {},
"ghcr.io/devcontainers/features/python:1": {
"installTools": true,
"optimize": true,
"version": "3.11"
}
},
"customizations": {
"vscode": {
"settings": {},
"extensions": [
"streetsidesoftware.code-spell-checker",
"ms-python.python",
"ms-python.vscode-pylance",
"ms-azuretools.vscode-docker",
"wayou.vscode-todo-highlight",
"gruntfuggly.todo-tree",
"eamodio.gitlens",
"github.vscode-pull-request-github",
"rangav.vscode-thunder-client"
]
}
},
// Features to add to the dev container. More info: https://containers.dev/features.
// "features": {},
// Use 'forwardPorts' to make a list of ports inside the container available locally.
"forwardPorts": [
8000
],
// Uncomment the next line to run commands after the container is created.
"postCreateCommand": "make install && make"
// Configure tool-specific properties.
// "customizations": {},
// Uncomment to connect as an existing user other than the container default. More info: https://aka.ms/dev-containers-non-root.
// "remoteUser": "devcontainer"
}
52 changes: 36 additions & 16 deletions TrackingBackend/main.py
Original file line number Diff line number Diff line change
@@ -1,16 +1,36 @@
from app.logger import setup_logger
from app.etvr import ETVR
from fastapi import FastAPI

setup_logger()


etvr_app = ETVR()
etvr_app.add_routes()
app = FastAPI()
app.include_router(etvr_app.router)


@app.get("/")
async def root():
return {"message": "Hello World!"}
from app.logger import setup_logger
from app.etvr import ETVR
from fastapi import FastAPI, WebSocket

setup_logger()


etvr_app = ETVR()
etvr_app.add_routes()
app = FastAPI()
app.include_router(etvr_app.router)


@app.get("/hello")
async def root():
return {"message": "Hello World!"}


@app.websocket("/")
async def websocket_endpoint(websocket: WebSocket):
print("[FastAPI WebSocket]: Accepting client connection...")
await websocket.accept()
while True:
try:
# Wait for any message from the client
await websocket.receive_text()
# Send message to the client
# resp = {'value': random.uniform(0, 1)}
# await websocket.send_json(resp)

# grab camera output and send over websocket

except Exception as e:
print("error:", e)
break
print("Bye..")

0 comments on commit 637434b

Please sign in to comment.