# mxy-socket.io-proxy

> socket.io client for node.js that can connect through a proxy server

Latest version **1.0.4** (published 2017-04-21) · MIT license · 0 weekly downloads

## Install

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

## 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.4 |
| Published | 2017-04-21 |
| First published | 2017-04-21 |
| Weekly downloads | 0 |
| License | MIT |
| TypeScript types | none |
| Module format | CommonJS |
| Node | * |
| Dependencies | 1 |
| Known vulnerabilities | 0 |
| Install scripts | no |
| GitHub stars | 29 |
| Author | Stephan Brenner |
| Maintainers | stevecruise |

## Links

- npm: https://www.npmjs.com/package/mxy-socket.io-proxy
- Repository: https://github.com/ymx/socket.io-proxy
- Issues: https://github.com/ymx/socket.io-proxy/issues
- npm.io page: https://npm.io/package/mxy-socket.io-proxy

## Dependencies (1)

- [socket.io-client](https://npm.io/package/socket.io-client.md) >=0.9.16

## Recent versions

- 1.0.4 (latest) — 2017-04-21
- 1.0.3 — 2017-04-21

## README

socket.io-proxy
===============

A socket.io client for node.js that can connect through a proxy server.

[![Build Status](https://travis-ci.org/stbrenner/socket.io-proxy.png?branch=master)](https://travis-ci.org/stbrenner/socket.io-proxy)

Installation
------------

```shell
$ npm install mxy-socket.io-proxy
```

How to use
----------

### Based on environment variable

mxy-socket.io-proxy will automatically apply the proxy settings based on the http\_proxy environment variable. 
If no proxy is defined, a direct connection to the destination will be established.

```ruby
var proxy = require('socket.io-proxy');

var socket = proxy.connect('http://destination');

socket.on('connect', function () {
    console.log('Socket connected');
    socket.on('command', function (data) {
        console.log('Received data');
    });
    socket.on('disconnect', function() {
        console.log('Socket disconnected');
    });
});
```

On Linux you can specify the environment variable in the following way: `export http_proxy=http://proxy:8080`

On Windows: `set HTTP_PROXY=http://proxy:8080`


### Explicit proxy definition

You can also directly specify the proxy server using the init function.

```ruby
var proxy = require('socket.io-proxy');

proxy.init('http://proxy:8080');
var socket = proxy.connect('http://destination');

socket.on('connect', function () {
    console.log('Socket connected');
    socket.on('command', function (data) {
        console.log('Received data');
    });
    socket.on('disconnect', function() {
        console.log('Socket disconnected');
    });
});
```

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