# gallium-io

> A backend library for gallium-react

Latest version **1.0.3** (published 2022-04-10) · ISC license · 0 weekly downloads

## Install

```sh
npm install gallium-io
pnpm add gallium-io
yarn add gallium-io
bun add gallium-io
```

## 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.3 |
| Published | 2022-04-10 |
| First published | 2022-04-09 |
| Weekly downloads | 0 |
| License | ISC |
| TypeScript types | none |
| Module format | CommonJS |
| Dependencies | 0 |
| Unpacked size | 7.4 KB |
| Known vulnerabilities | 0 |
| Install scripts | no |
| Maintainers | abhinaviswierd |
| Keywords | websocket, node.js, javascript |

## Links

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

## 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.3 (latest) — 2022-04-10
- 1.0.2 — 2022-04-10
- 1.0.1 — 2022-04-09
- 1.0.0 — 2022-04-09

## README

# What is this about?

It is a package for node.js, that will ensure easy websocket configuration without any manual code.
In two steps the websocket connection is made.

# How to install ?

`npm i gallium-io --save`

Then..

```

const {MakeConnection} = require('gallium-io')
const wss = MakeConnection(server)
wss.OnConnect(true)

```

Step 1. Import MakeConnection function from gallium-io

Step 2. Make the WebSocketServer using the MakeConnection

Step 3. And then to start the websocket use wss.onConnect(true). 

Note: Make sure your frontend is set up with gallium-react, Before initiating the server. The best part about it
is that we can also handle http requests on our server, which handles both the WS connection as well as normal express server.

# Here is the full setup

```
const express = require('express')
const app = express()
const server = require('http').createServer(app);
const {MakeConnection} = require('gallium-io')
const wss = MakeConnection(server)
const Ws = wss.OnConnect(true)

app.get('/',(req,res)=>{res.send("Hello world")})


server.listen(9876, ()=>console.log(`Listening on port ${9876}`))
```
Note: Both gallium-react and gallium-io should be on same WS connetion and port.

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