https://github.com/patrickhollweck/srocket
A socket.io framework focusing on type-safety
https://github.com/patrickhollweck/srocket
framework nodejs socket-io typescript typescript-library web websocket
Last synced: 9 months ago
JSON representation
A socket.io framework focusing on type-safety
- Host: GitHub
- URL: https://github.com/patrickhollweck/srocket
- Owner: PatrickHollweck
- License: mit
- Created: 2018-02-13T13:31:51.000Z (almost 8 years ago)
- Default Branch: master
- Last Pushed: 2023-01-12T01:42:59.000Z (about 3 years ago)
- Last Synced: 2025-04-20T10:43:52.588Z (9 months ago)
- Topics: framework, nodejs, socket-io, typescript, typescript-library, web, websocket
- Language: TypeScript
- Homepage: https://patrickhollweck.github.io/SRocket/#/
- Size: 2.42 MB
- Stars: 4
- Watchers: 0
- Forks: 1
- Open Issues: 22
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# SRocket
A [Socket.IO](https://socket.io/docs) Framework focusing on being **type-safe**.
[](https://travis-ci.org/PatrickHollweck/SRocket)
[](https://app.fossa.io/projects/git%2Bgithub.com%2FPatrickHollweck%2FSRocket?ref=badge_shield)
[](https://snyk.io/test/github/PatrickHollweck/SRocket)
[](https://www.codefactor.io/repository/github/patrickhollweck/srocket)
[📚 Docs](https://patrickhollweck.github.io/SRocket/#/)
[💨 Quickstart](https://patrickhollweck.github.io/SRocket/#/quickstart)
[📝 Source Code](https://github.com/PatrickHollweck/srocket)
Built with ❤︎ by Patrick Hollweck
## Sneak Peak
### Server
```ts
import { SRocket, SocketController, Controller, SocketRoute SEvent, V } from "srocket";
@SocketController()
class UserController extends Controller
{
greet(event: SEvent) {
const data = event.request.validate(
V.type({
name: V.string,
}
);
event.response
.withData({
greeting: `Hey, ${data.name}`,
})
.acknowledge();
}
}
SRocket.fromPort(5555)
.controllers(UserController)
.listen(() => console.log("SRocket listening at http://localhost:5555"));
```
### Client
```ts
const socket = io.connect("http://localhost:5555");
socket.emit("greet", { name: "Patrick" }, console.log);
>> "Hello, Patrick"
```
Interested? Visit the [docs](https://patrickhollweck.github.io/SRocket/#/)