Skip to content

Commit b668163

Browse files
committed
nodejs websocket
1 parent c3433b8 commit b668163

11 files changed

Lines changed: 1088 additions & 9 deletions

File tree

README.md

Lines changed: 10 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -18,20 +18,21 @@ We have grouped the samples into multiple groups
1818

1919
#### JavaScript / TypeScript
2020

21-
| Name | Stack | Description | Preview |
22-
| --------------------------------------- | --------------------------------------------------------------------------------------------------------------- | ---------------------------------------------------------------------------- | ------------------------------------------------------------------ |
23-
| [Astro](./astro/README.md) | [Astro](https://astro.build/), [Nginx](https://nginx.org/) | A simple Astro generated static website hosted on lttle.cloud | [Link](https://astro--samples--public--aifrim.eu.lttle.host/) |
24-
| [Next.js App](./nextjs-app/README.md) | [Next.js](https://nextjs.org/), [Drizzle ORM](https://orm.drizzle.team/), [PostgreSQL](https://postgresql.org/) | A simple CRUD Next.js application hosted on lttle.cloud | [Link](https://nextjs-app--samples--public--aifrim.eu.lttle.host/) |
25-
| [React + Vite](./react-vite/README.md) | [React](https://react.dev/), [Vite](https://vite.dev/) | A simple client-only React application built with vite hosted on lttle.cloud | [Link](https://react-vite--samples--public--aifrim.eu.lttle.host/) |
26-
| [Hono API](./nodejs/hono-api/README.md) | [Hono](https://hono.dev/), [Drizzle ORM](https://orm.drizzle.team/), [PostgreSQL](https://postgresql.org/) | A simple CRUD API using Hono framework hosted on lttle.cloud | [Link](https://hono-api--samples--public--aifrim.eu.lttle.host/) |
21+
| Name | Stack | Description | Preview |
22+
| ------------------------------------------- | --------------------------------------------------------------------------------------------------------------- | ------------------------------------------------------------- | ------------------------------------------------------------------------ |
23+
| [Astro](./astro/README.md) | [Astro](https://astro.build/), [Nginx](https://nginx.org/) | A simple Astro generated static website | [Link](https://astro--samples--public--aifrim.eu.lttle.host/) |
24+
| [Next.js App](./nextjs-app/README.md) | [Next.js](https://nextjs.org/), [Drizzle ORM](https://orm.drizzle.team/), [PostgreSQL](https://postgresql.org/) | A simple CRUD Next.js application | [Link](https://nextjs-app--samples--public--aifrim.eu.lttle.host/) |
25+
| [React + Vite](./react-vite/README.md) | [React](https://react.dev/), [Vite](https://vite.dev/) | A simple client-only React application built with vite | [Link](https://react-vite--samples--public--aifrim.eu.lttle.host/) |
26+
| [Hono API](./nodejs/hono-api/README.md) | [Hono](https://hono.dev/), [Drizzle ORM](https://orm.drizzle.team/), [PostgreSQL](https://postgresql.org/) | A simple CRUD API using Hono framework | [Link](https://hono-api--samples--public--aifrim.eu.lttle.host/) |
27+
| [Websockets](./nodejs/websockets/README.md) | [Node.js](https://nodejs.org/) | A simple WebSocket server & client using native WebSocket API | [Link](https://websocket-client--samples--public--aifrim.eu.lttle.host/) |
2728

2829
#### Python
2930

3031
For Python samples we recommend you install [`uv`](https://docs.astral.sh/uv/) beforehand.
3132

32-
| Name | Stack | Description | Preview |
33-
| ------------------------------------- | ----------------------------------------------------------------------------- | -------------------------------------------------- | --------------------------------------------------------------- |
34-
| [FastAPI](./python/fastapi/README.md) | [FastAPI](https://fastapi.tiangolo.com/), [Uvicorn](https://www.uvicorn.org/) | A simple FastAPI application hosted on lttle.cloud | [Link](https://fastapi--samples--public--aifrim.eu.lttle.host/) |
33+
| Name | Stack | Description | Preview |
34+
| ------------------------------------- | ----------------------------------------------------------------------------- | ---------------------------- | --------------------------------------------------------------- |
35+
| [FastAPI](./python/fastapi/README.md) | [FastAPI](https://fastapi.tiangolo.com/), [Uvicorn](https://www.uvicorn.org/) | A simple FastAPI application | [Link](https://fastapi--samples--public--aifrim.eu.lttle.host/) |
3536

3637
### Software
3738

nodejs/websockets/README.md

Lines changed: 32 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,32 @@
1+
# Websockets | lttle.cloud
2+
3+
This is a simple WebSocket server sample project for [lttle.cloud](https://lttle.cloud).
4+
5+
It demonstrates how to deploy a WebSocket server using Node.js and Nginx on lttle.cloud's platform.
6+
7+
## Running locally
8+
9+
Run the following command to start the WebSocket server and a static file server using Nginx:
10+
11+
```bash
12+
npm run dev
13+
```
14+
15+
Then open your browser and navigate to `http://localhost:8000` (or the port your static file server is running on) to access the WebSocket client.
16+
17+
## Deploy
18+
19+
To deploy the project to lttle.cloud, run:
20+
21+
```bash
22+
lttle deploy websockets.lttle.yaml
23+
```
24+
25+
This will build two Docker images
26+
27+
1. One for the WebSocket server
28+
2. One for the Nginx server to serve the static files that when accessed will connect to the WebSocket server.
29+
30+
After that you can access your WebSocket client at `https://websocket-client--samples--public--your-tenant.eu.lttle.host/` where `your-tenant` is your lttle.cloud tenant name.
31+
32+
You can check our deployment of this sample [https://websocket-client--samples--public--aifrim.eu.lttle.host/](https://websocket-client--samples--public--aifrim.eu.lttle.host/).

0 commit comments

Comments
 (0)