Skip to content

PatrickHollweck/SRocket

This branch is 1 commit ahead of master.

Folders and files

NameName
Last commit message
Last commit date

Latest commit

de70028 · Mar 30, 2021
May 29, 2019
May 30, 2019
Jun 10, 2019
Jun 10, 2019
Jun 1, 2019
Feb 12, 2018
May 30, 2019
Mar 18, 2018
Jul 31, 2018
May 29, 2019
Feb 13, 2018
Jun 10, 2019
Jun 1, 2019
Jun 10, 2019
Jun 23, 2018
Mar 30, 2021
Jun 4, 2019
Jun 4, 2019
Jun 10, 2019

Repository files navigation

SRocket

A Socket.IO Framework focusing on being type-safe.

TRAVISCI Status FOSSA Status Known Vulnerabilities CodeFactor


📚 Docs

💨 Quickstart

📝 Source Code


Built with ❤︎ by Patrick Hollweck

Sneak Peak

Server

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

const socket = io.connect("http://localhost:5555");

socket.emit("greet", { name: "Patrick" }, console.log);
>> "Hello, Patrick"

Interested? Visit the docs