Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/lucko/bytesocks
Fast & lightweight WebSocket server with channels.
https://github.com/lucko/bytesocks
websocket websockets
Last synced: 7 days ago
JSON representation
Fast & lightweight WebSocket server with channels.
- Host: GitHub
- URL: https://github.com/lucko/bytesocks
- Owner: lucko
- License: mit
- Created: 2022-01-09T00:34:01.000Z (almost 3 years ago)
- Default Branch: master
- Last Pushed: 2024-04-25T21:39:33.000Z (7 months ago)
- Last Synced: 2024-05-01T21:21:27.857Z (7 months ago)
- Topics: websocket, websockets
- Language: Java
- Homepage:
- Size: 76.2 KB
- Stars: 19
- Watchers: 1
- Forks: 4
- Open Issues: 2
-
Metadata Files:
- Readme: README.md
- License: LICENSE.txt
Awesome Lists containing this project
README
bytesocks is a fast & lightweight WebSocket server.It allows clients to create "**channels**", connect using the WebSocket protocol and **exchange messages with other clients** in the same channel.
In many ways bytesocks is the "socket" sibling of [bytebin](https://github.com/lucko/bytebin). bytebin accepts http get and post requests which allows clients to exchange data asynchronously (client A posts, then client B reads later), whereas bytesocks uses sockets to send messages synchronously (in real time and bidirectionally, client A sends and client B receives).
## Running bytesocks
The easiest way to spin up a bytesocks instance is using Docker. Images are automatically created and published to GitHub for each commit/release.
Assuming you're in the bytesocks directory, just run:
```bash
$ docker compose up
```You should then (hopefully!) be able to access the application at `http://localhost:3000/`.
It's that easy!
## API Usage
### Create a channel
To create a channel, send an HTTP `GET` request to `/create`.
A unique key that identifies the newly created channel will be returned. You can find it:
* In the response `Location` header.
* In the response body, encoded as JSON - `{"key": "aabbcc"}`.### Join a channel
Send an HTTP `GET` request to `/{key}` with the headers:
```
Connection: Upgrade
Upgrade: websocket
```At this stage it's probably easier to find an HTTP client library that supports web sockets instead of reimplementing the protocol yourself!
## License
MIT, have fun!