diff --git a/Dockerfile b/Dockerfile index fc3d737..b61c350 100644 --- a/Dockerfile +++ b/Dockerfile @@ -18,6 +18,7 @@ RUN apt-get update -y && \ # <--- Scripts --> COPY docker/bin /app/bin +COPY docker/hypercorn.toml /app/hypercorn.toml # <--- PREP --> RUN /app/bin/prep.sh diff --git a/api/src/ws_redirect/__init__.py b/api/src/ws_redirect/__init__.py index 79c024f..544ed92 100644 --- a/api/src/ws_redirect/__init__.py +++ b/api/src/ws_redirect/__init__.py @@ -34,7 +34,12 @@ class WSRedirector: return await self._client.send(msg) async def start(self): - async with connect(self._host) as websocket: + async with connect( + self._host, + max_size=16 * 2**20, + read_limit=16 * 2**20, + write_limit=16 * 2**20, + ) as websocket: self._client = websocket await websocket.send(json.dumps({"type": "auth", "access_token": self._token})) while not self.is_closed: diff --git a/docker/bin/run.sh b/docker/bin/run.sh index 6ddf90a..a420402 100755 --- a/docker/bin/run.sh +++ b/docker/bin/run.sh @@ -12,4 +12,4 @@ echo "HOST = $host_port" echo "HASSIO_WS = $HASSIO_WS" echo $(python --version) echo "--------------------" -python -m hypercorn src.app:app -b $host_port +python -m hypercorn src.app:app -b $host_port --config /app/hypercorn.toml diff --git a/docker/hypercorn.toml b/docker/hypercorn.toml new file mode 100644 index 0000000..92f1c87 --- /dev/null +++ b/docker/hypercorn.toml @@ -0,0 +1 @@ +websocket_max_message_size = 16777216 \ No newline at end of file diff --git a/webapp/src/apiService/mock.test.ts b/webapp/src/apiService/mock.test.ts index aa39722..635aa81 100644 --- a/webapp/src/apiService/mock.test.ts +++ b/webapp/src/apiService/mock.test.ts @@ -24,12 +24,12 @@ test("mock api uses initial autos for initial population -- some data", async () test("populate mock api with some data", async () => { const mockApi = makeAutomationAPI(useMockAPI([], fakeUseRef as any)); - await mockApi.update(createMockAuto()); + await mockApi.create(createMockAuto()); let data = await mockApi.list({ limit: 10, offset: 0 }); expect(data.ok).toBe(true); expect((data as any).data.data).toHaveLength(1); expect((data as any).data.totalItems).toBe(1); - await mockApi.update(createMockAuto()); + await mockApi.create(createMockAuto()); data = await mockApi.list({ limit: 10, offset: 0 }); expect((data as any).data.data).toHaveLength(2); expect((data as any).data.totalItems).toBe(2);