npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2024 – Pkg Stats / Ryan Hefner

@jheubuch/ng-ws-template

v1.0.3

Published

Angular WebSocket template for AsyncAPI generator

Downloads

3

Readme

AsyncAPI Angular WebSocket Template

This template generates a typescript module for WebSocket connections based on rxjs.

Usage

ag asyncapi.json @jheubuch/ng-ws-template -p server=serverName -o outputDir

This will generate your channel services and message models to your specified output directory.

Supported Parameters

|Name|Description|Required|Example| |----|-----------|--------|-------| |server|Specifies the server in the AsyncAPI document which should be used for client generation.|Yes|server=production| |clientId|Specifies the client id for the client you are generating the APIs for. (For use with AsyncApiWebSocketMiddleware).|No|clientId=FrontendApp|

What is being generated

  • The services for communication to the server (can be found at output/services/index.ts)
  • The models used in the Messages (can be found at output/models/{Message}.ts)
  • The API module which provides the services and can be included in the app.module.ts (can be found at output/api.module.ts)

How to use the services

  1. Include ApiModule to your AppModule:
 import { ApiModule } from '{output}/api.module';

 @NgModule({
     ...
     imports: [
         ...,
         ApiModule
     ]
 })
  1. Use the services in your components via dependency injection:
 import { HelloWorldService } from '{output}/services';

 export class AppComponent {
     ...
     constructor(
         private helloWorldService: HelloWorldService
     ) { ... }
 }
  1. Send to and receive from the service:
 // Subscribe to receive data; will be triggered every time something is received on the channel
 this.helloWorldService.subject.subscribe((data => {
     // Do something with your data!
 }));

 // Send data to your channel
 this.helloWorldService.sendToSocket(object);