# wsurl

> Derive a websocket url from a http(s) or protocol relative url

Latest version **1.0.0** (published 2014-10-24) · ISC license · 0 weekly downloads

## Install

```sh
npm install wsurl
pnpm add wsurl
yarn add wsurl
bun add wsurl
```

## 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 |
| Published | 2014-10-24 |
| First published | 2014-10-24 |
| Weekly downloads | 0 |
| License | ISC |
| TypeScript types | none |
| Module format | CommonJS |
| Dependencies | 0 |
| Known vulnerabilities | 0 |
| Install scripts | no |
| Author | Damon Oehlman |
| Maintainers | damonoehlman |
| Keywords | websocket, url |

## Links

- npm: https://www.npmjs.com/package/wsurl
- Repository: https://github.com/DamonOehlman/wsurl
- Issues: https://github.com/DamonOehlman/wsurl/issues
- npm.io page: https://npm.io/package/wsurl

## 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 (latest) — 2014-10-24

## README

# wsurl

Given a url (including protocol relative urls - i.e. `//`), generate an appropriate
url for a WebSocket endpoint (`ws` or `wss`).


[![NPM](https://nodei.co/npm/wsurl.png)](https://nodei.co/npm/wsurl/)

[![stable](https://img.shields.io/badge/stability-stable-green.svg)](https://github.com/dominictarr/stability#stable) [![Build Status](https://img.shields.io/travis/DamonOehlman/wsurl.svg?branch=master)](https://travis-ci.org/DamonOehlman/wsurl) 

## Example Usage

```js
var wsurl = require('wsurl');

console.log(wsurl('//test.com'));

// When run in a browser from http://
// -> ws://test.com

// When run in a browser from https://
// -> wss://test.com

// When run from node (no location.href available)
// -> wss://test.com (assume secure)

// when run in a browser from file://
// -> wss://test.com (assume secure)

```

## License(s)

### ISC

Copyright (c) 2014, Damon Oehlman <damon.oehlman@gmail.com>

Permission to use, copy, modify, and/or distribute this software for any
purpose with or without fee is hereby granted, provided that the above
copyright notice and this permission notice appear in all copies.

THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES WITH
REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY
AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT,
INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM
LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR
OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
PERFORMANCE OF THIS SOFTWARE.

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