# @types/socketty

> TypeScript definitions for socketty

Latest version **0.2.30** (published 2023-11-07) · MIT license · 0 weekly downloads

## Install

```sh
npm install @types/socketty
pnpm add @types/socketty
yarn add @types/socketty
bun add @types/socketty
```

## Health

**Score 45/100 (D)** — status: abandoned.

Positive: has types; no vulnerabilities; high maintenance score; popular repo; extremely popular.

Warnings: low downloads; no esm support; pre 1.0.

Negative: abandoned.

## Facts

| | |
|---|---|
| Version | 0.2.30 |
| Published | 2023-11-07 |
| First published | 2016-05-17 |
| Weekly downloads | 0 |
| License | MIT |
| TypeScript types | bundled |
| Module format | CommonJS |
| Dependencies | 0 |
| Unpacked size | 5.6 KB |
| Known vulnerabilities | 0 |
| Install scripts | no |
| GitHub stars | 51449 |
| Maintainers | types |

## Links

- npm: https://www.npmjs.com/package/@types/socketty
- Repository: https://github.com/DefinitelyTyped/DefinitelyTyped
- Homepage: https://github.com/DefinitelyTyped/DefinitelyTyped/tree/master/types/socketty
- npm.io page: https://npm.io/package/@types/socketty

## Recent versions

- 0.2.30 (latest) — 2023-11-07
- 0.2.27 (ts2.0) — 2016-09-19
- 0.2.29 — 2023-10-18
- 0.2.28 — 2023-09-25
- 0.2.26 — 2016-07-14
- 0.2.25-alpha — 2016-07-08
- 0.2.24-alpha — 2016-07-04
- 0.2.23-alpha — 2016-07-02
- 0.2.22-alpha — 2016-07-02
- 0.2.21-alpha — 2016-07-01
- 0.2.20-alpha — 2016-05-25
- 0.2.19-alpha — 2016-05-20
- 0.2.14-alpha — 2016-05-19
- 0.2.13-alpha — 2016-05-17

## README

# Installation
> `npm install --save @types/socketty`

# Summary
This package contains type definitions for socketty (https://www.npmjs.com/package/socketty).

# Details
Files were exported from https://github.com/DefinitelyTyped/DefinitelyTyped/tree/master/types/socketty.
## [index.d.ts](https://github.com/DefinitelyTyped/DefinitelyTyped/tree/master/types/socketty/index.d.ts)
````ts
declare var socketty: socketty.Socketty;

export = socketty;
export as namespace socketty;

declare namespace socketty {
    interface Socketty {
        /**
         * Connect to a socketty server.
         * @param url The server url
         * @param callback The callback to be run when the connection is open
         * @return A Socket
         */
        connect(url: string, callback: (socket: SockettySocket) => void): SockettySocket;

        /**
         * Create a socketty server.
         * @param httpServer The HTTP server to use
         * @return A socketty server
         */
        createServer(httpServer: any): SockettyServer;
    }

    interface SockettySocket {
        /**
         * Listen for an action.
         * @param action The action to listen to
         * @param callback A callback to be run when the action is fired
         */
        on(action: string, callback: (message?: any) => void): void;

        /**
         * Send an action, as well as an optional message.
         * @param action The action to send
         * @param message The message to send
         */
        send(action: string, message?: any): void;

        /**
         * Specify a callback to be run when the socket is disconnected.
         * @param callback The disconnect callback
         */
        disconnect(callback: () => void): void;
    }

    interface SockettyServer {
        /**
         * Specify a callback to be run when a new socket connects to the server.
         * @param callback The callback
         */
        connection(callback: (socket: SockettySocket) => void): void;
    }
}

````

### Additional Details
 * Last updated: Tue, 07 Nov 2023 15:11:36 GMT
 * Dependencies: none

# Credits
These definitions were written by [Nax](https://github.com/Nax).

---
_Source: https://npm.io/package/@types/socketty · Machine-readable twin of the npm.io package page. Health data is recomputed on every publish._
