@nexjs-ws

Introduction

We use websocket as an Inter program or module communication protocol. I develop a custom protocol over Websocket that implement this 2 Patterns

  • Request/Response Pattern

  • Publish/Subscribe Pattern

We can response to almost any problems in a effective way with a combination of this 2 patterns:

  • Synchronized calls

  • Notifications by Events

the idea

Separate in server the Functionality (Contract) from the call protocol and transport (Rest API, Websocket TCP IP, HTTP, ...) and create or update typed clients automatically. the main goals are

  • Alway typed (Client and Server)

  • Never implement a client

  • Any update generate errors in code

  • Separate functions (contracts) from transports and protocols. You van bind multiples protocols and transports on one server without code duplication.

  • Realtime Applications: the combination of Publish/Subscribe and Rest is required for an easy implementation.

  • Really simplified server code.

  • Authentication separated from functionality

Code overview

  • Only Implements the server

  • automatic client generation (ts or c#)

server

cli (typed api client creation)

client

Repositories

npm pakages

Repository name

Links

Description

@nexjs/wsserver

Server Decorators and Bindings Class

@nexjs/wsclient

Client Base Class (required by all clients)

@nexjs/cli

Command line to generate/update Clients

Dev repositories

Repository name

Link

Description

nexjs-ws.dev.server

Project with @nexjs/wsserver as source code (debuggable)

nexjs-ws.dev.client

Project with @nexjs/wsclient as source code (debuggable)

Demo repositories

Repository name

Link

Description

nexjs-ws.demo.server.base

minimal express server

nexjs-ws.demo.server.nestjs

nestjs, mongoDb

nexjs-ws.demo.client.vue

minimal client

nexjs-ws.demo.client.vuetify

client with auth, http api and ws api

nexjs-ws.demo.client.nuxt

client with auth, http api and ws api

Last updated

Was this helpful?