# socket.io-server

> A simple bootstrap project for creating node.js servers with socket.io

Latest version **1.0.0-b** (published 2017-09-21) · MIT license · 0 weekly downloads

## Install

```sh
npm install socket.io-server
pnpm add socket.io-server
yarn add socket.io-server
bun add socket.io-server
```

## Health

**Score 15/100 (F)** — status: abandoned.

Positive: no vulnerabilities.

Warnings: low downloads; no types; no esm support.

Negative: abandoned; low maintenance score.

## Facts

| | |
|---|---|
| Version | 1.0.0-b |
| Published | 2017-09-21 |
| First published | 2017-09-21 |
| Weekly downloads | 0 |
| License | MIT |
| TypeScript types | none |
| Module format | CommonJS |
| Dependencies | 3 |
| Known vulnerabilities | 0 |
| Install scripts | no |
| Author | tyurderi@yahoo.de |
| Maintainers | tyurderi |
| Keywords | socket, server, io |

## Links

- npm: https://www.npmjs.com/package/socket.io-server
- npm.io page: https://npm.io/package/socket.io-server

## Dependencies (3)

- [events](https://npm.io/package/events.md) ^1.1.1
- [extend](https://npm.io/package/extend.md) ^3.0.1
- [socket.io](https://npm.io/package/socket.io.md) ^2.0.3

## Alternatives

- [@opentelemetry/exporter-zipkin](https://npm.io/package/@opentelemetry/exporter-zipkin.md) — 14.8M weekly downloads
- [pusher-js](https://npm.io/package/pusher-js.md) — 2.0M weekly downloads
- [browserify](https://npm.io/package/browserify.md) — 1.7M weekly downloads
- [sqs-consumer](https://npm.io/package/sqs-consumer.md) — 1.7M weekly downloads
- [@sanity/eventsource](https://npm.io/package/@sanity/eventsource.md) — 930.8K weekly downloads

## Recent versions

- 1.0.0-b (latest) — 2017-09-21
- 1.0.0 — 2017-09-21

## README

# Socket.IO Server
A simple bootstrap project for creating node.js servers with socket.io

## Setup
In the following a simple bootstrap script to setup your server. For a detailed example follow the content in example.js

###### ./index.js
```javascript
import {App} from 'socket.io-server'

import TestCommand from './src/Commands/TestCommand'

let app = new App({
    port: 8303, // The port the server shoud listen to
    commands: [
        TestCommand
    ]
});

app.run();
```
 
./src/Commands/TestCommand.js
```javascript
import {BaseCommand} from 'socket.io-server'

export default class TestCommand extends BaseCommand 
{
    initialize()
    {
        this.name = 'test';
    }
    
    execute()
    {
        console.log('test executed')
    }
}
```

If you take a look at the base command you can see that you have access to the following objects:

```javascript
export default class BaseCommand
{
    constructor(app, client)
    {
        this.app    = app;    // The app instance it self
        this.client = client; // A personalized instance of the client
        this.name   = null;   // The name of the command which is required to execute the command
        
        this.initialize();
    }
}
```

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