@types/stompjs
TypeScript icon, indicating that this package has built-in type declarations

2.3.9 • Public • Published

Installation

npm install --save @types/stompjs

Summary

This package contains type definitions for stompjs (https://github.com/jmesnil/stomp-websocket).

Details

Files were exported from https://github.com/DefinitelyTyped/DefinitelyTyped/tree/master/types/stompjs.

index.d.ts

/// <reference types="node" />

export const VERSIONS: {
    V1_0: string;
    V1_1: string;
    V1_2: string;
    supportedVersions: () => string[];
};

export class Client {
    connected: boolean;
    counter: number;
    heartbeat: {
        incoming: number;
        outgoing: number;
    };
    maxWebSocketFrameSize: number;
    subscriptions: {};
    ws: WebSocket;

    debug(...args: string[]): any;

    connect(
        headers: { login: string; passcode: string; host?: string | undefined },
        connectCallback: (frame?: Frame) => any,
        errorCallback?: (error: Frame | string) => any,
    ): any;
    connect(headers: {}, connectCallback: (frame?: Frame) => any, errorCallback?: (error: Frame | string) => any): any;
    connect(
        login: string,
        passcode: string,
        connectCallback: (frame?: Frame) => any,
        errorCallback?: (error: Frame | string) => any,
        host?: string,
    ): any;
    disconnect(disconnectCallback: () => any, headers?: {}): any;

    send(destination: string, headers?: {}, body?: string): any;
    subscribe(destination: string, callback?: (message: Message) => any, headers?: {}): Subscription;
    unsubscribe(id: string): void;

    begin(transaction: string): any;
    commit(transaction: string): any;
    abort(transaction: string): any;

    ack(messageID: string, subscription: string, headers?: {}): any;
    nack(messageID: string, subscription: string, headers?: {}): any;
}

export interface Subscription {
    id: string;
    unsubscribe(): void;
}

export interface Message extends Frame {
    ack(headers?: {}): any;
    nack(headers?: {}): any;
}

export class Frame {
    command: string;
    headers: {};
    body: string;
    constructor(command: string, headers?: {}, body?: string);

    toString(): string;
    static sizeOfUTF8(s: string): number;
    static unmarshall(datas: any): any;
    static marshall(command: string, headers?: {}, body?: string): any;
}

export function client(url: string, protocols?: string | string[]): Client;
export function over(ws: WebSocket): Client;
export function overTCP(host: string, port: number): Client;
export function overWS(url: string): Client;
export function setInterval(interval: number, f: (...args: any[]) => void): NodeJS.Timer;
export function clearInterval(id: NodeJS.Timer): void;

Additional Details

  • Last updated: Mon, 20 Nov 2023 23:36:24 GMT
  • Dependencies: @types/node

Credits

These definitions were written by Jimi Charalampidis, and Stefan Erichsen.

Readme

Keywords

none

Package Sidebar

Install

npm i @types/stompjs

Weekly Downloads

24,941

Version

2.3.9

License

MIT

Unpacked Size

7.48 kB

Total Files

5

Last publish

Collaborators

  • types