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 🙏

© 2026 – Pkg Stats / Ryan Hefner

@macrix/pct-cmd

v1.0.27

Published

Package provide communication layer to ProconTel web infrastructure

Readme

pct-cmd

npm version install size npm downloads

Table of Contents

  1. Quick introduction
  2. Installation
  3. Features
  4. Angular
    1. Start connection
    2. Reconnect
    3. On
    4. Off
    5. Post
    6. Get
  5. React
    1. Start connection
    2. Reconnect
    3. On
    4. Off
    5. Post
    6. Get
  6. Deployment

1. Quick introduction

pct-cmd is a modern npm package provide communication layer to ProconTel web infrastructure.

2. Installation

You can install the latest released JavaScript client from npm with the following command:

npm install @macrix/pct-cmd

3. Features

Table below lists feature available in package @macrix/pct-cmd and compares it with features available in next release.

| Feature | npm version | Next | | :--- |:---: |:---: | | Start connection | ✓ | ✓ | | Reconnect | ✓ | ✓ | | On | ✓ | ✓ | | Off | ✓ | ✓ | | Post | ✓ | ✓ | | Get | ✓ | ✓ |

4. Angular

List of code samples which describes how to integrate @macrix/pct-cmd with angular framework. To run angular sample app run command: docker run --rm -p 3000:80 macrix/pct-ng-app

  • Start connection

This is simple example how to start connection with endpoint.

import { EndpointConnection } from '@macrix/pct-cmd';

export class EndpointConnectionFactory {
    public async start(baseUrl: string): Promise<EndpointConnection> {
        const endpointConnection = new EndpointConnection(baseUrl + '/hubs/commands/');
        await endpointConnection.start();
        return endpointConnection;
    }
}

or use existing factory method

import { EndpointConnectionFactory, IEndpointConnection } from '@macrix/pct-cmd';

export class AppComponent implements OnInit {
  endpointConnection: IEndpointConnection;
  constructor(private connectionFactory: EndpointConnectionFactoryr) { }
  async start() {
    this.endpointConnection = this.connectionFactory.create(environment.procontelEndpointUrl);
    await this.endpointConnection.start();
  }
}
  • Reconnect

This is simple example how to appropriate handle reconnect process.

IMPORTANT: Always unsubscribe and subscribe during reconnect process.

  this.endpointConnection = this.connectionFactory.create(environment.procontelEndpointUrl);
    this.endpointConnection.onconnected(async id => {
      await this.endpointConnection.off('order_created');
      await this.endpointConnection.on('order_created', (command) => {
        //some business logic
      });
    });
  • On

This is simple example how we can subscribe on server push notification.

IMPORTANT: Subscribe on server push notification after connection start established.

  this.endpointConnection = this.connectionFactory.create(environment.procontelEndpointUrl);
  await this.endpointConnection.start();
  await this.endpointConnection.on('order_created', (command) => {
    //some business logic
  });
});
  • Off

This is simple example how we can unsubscribe on server push notification.

  await this.endpointConnection.off('order_created');
  • Post

This is simple example how we can send POST command. Operation result will be deliver by server push notification.

  await this.endpointConnection.on('order_created', (command) => {
    //some business logic
  });

  this.endpointConnection
    .post('create_order', this.command)
    .then(x => console.log('Command sent.'));
  • Get

This is simple example how we can send GET command. Operation result will be deliver as a GET method result.

  this.endpointConnection
    .get('create_order_sync', this.command)
    .then(x => {
      //some business logic
    }));

5. React

List of code samples which describes how to integrate @macrix/pct-cmd with react framework. To run react sample app run command: docker run --rm -p 3000:80 macrix/pct-react-app

  • Start connection

This is simple example how to start connection with endpoint.

import { EndpointConnection } from '@macrix/pct-cmd';

export class EndpointConnectionFactory {
    public async start(baseUrl: string): Promise<EndpointConnection> {
        const endpointConnection = new EndpointConnection(baseUrl + '/hubs/commands/');
        await endpointConnection.start();
        return endpointConnection;
    }
}

or use existing factory method

import { EndpointConnectionFactory, IEndpointConnection } from '@macrix/pct-cmd';

export const AppComponent: React.FC = props => {
  const [factory] = React.useState(new EndpointConnectionFactory());
  const [endpointConnection, setEndpointConnection] = React.useState<IEndpointConnection>(null!);
  async start() {
    const connection = factory.create(environment.procontelEndpointUrl);
    await this.endpointConnection.start();
    setEndpointConnection(connection);
  }
}
  • Reconnect

This is simple example how to appropriate handle reconnect process.

IMPORTANT: Always unsubscribe and subscribe during reconnect process.

  const connection = factory.create(environment.procontelEndpointUrl);
  connection.onconnected(async id => {
    await connection.off('order_created');
    await connection.on('order_created', (command) => {
      //some business logic
    });
  });
  await connection.start();
  • On

This is simple example how we can subscribe on server push notification.

IMPORTANT: Subscribe on server push notification after connection start established.

  const connection = factory.create(environment.procontelEndpointUrl);
  await connection.start();
  await connection.on('order_created', (command) => {
    //some business logic
  });
  • Off

This is simple example how we can unsubscribe on server push notification.

  await endpointConnection.off('order_created');
  • Pos

This is simple example how we can send POST command. Operation result will be deliver by server push notification.

  await endpointConnection.on('order_created', (command) => {
    //some business logic
  });

  endpointConnection
    .post('create_order', command)
    .then(x => console.log('Command sent.'));
  • Get

This is simple example how we can send GET command. Operation result will be deliver as a GET method result.

  endpointConnection
    .get('create_order_sync', this.command)
    .then(x => {
      //some business logic
    }));

<div id='id-deployment'/>

## 6. Deployment

<div id='id-deployment-github'/>

* ### Github
```csharp
  • GitLab