Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

multiserver

Package Overview
Dependencies
Maintainers
21
Versions
67
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

multiserver - npm Package Compare versions

Comparing version 3.4.0 to 3.5.0

2

package.json
{
"name": "multiserver",
"description": "write a server which works over many protocols at once, or connect to the same",
"version": "3.4.0",
"version": "3.5.0",
"homepage": "https://github.com/dominictarr/multiserver",

@@ -6,0 +6,0 @@ "repository": {

@@ -7,2 +7,4 @@ var WS = require('pull-ws')

var http = require('http')
var https = require('https')
var fs = require('fs')
var debug = require('debug')('multiserver:ws')

@@ -48,3 +50,3 @@

var secure = opts.server && !!opts.server.key
var secure = opts.server && !!opts.server.key || (!!opts.key && !!opts.cert)
return {

@@ -65,4 +67,10 @@ name: 'ws',

var server = opts.server || http.createServer(opts.handler)
if (typeof opts.key === 'string')
opts.key = fs.readFileSync(opts.key)
if (typeof opts.cert === 'string')
opts.cert = fs.readFileSync(opts.cert)
var server = opts.server ||
(opts.key && opts.cert ? https.createServer({ key: opts.key, cert: opts.cert }, opts.handler) : http.createServer(opts.handler))
WS.createServer(Object.assign({}, opts, {server: server}), function (stream) {

@@ -69,0 +77,0 @@ stream.address = safe_origin(

@@ -93,7 +93,7 @@ # multiserver

keys: keys,
appKey: appKey //application key
appKey: appKey, //application key
auth: accept_all
}),
]
]
])

@@ -232,3 +232,3 @@ console.log(ms.stringify())

```
### `WebSockets({host,port,scope,handler?})`
### `WebSockets({host,port,scope,handler?,key?,cert?})`

@@ -245,2 +245,5 @@ create a websocket server. Since websockets are

If `opts.key` and `opts.cert` are provided as paths, a https server
will be spawned.
``` js

@@ -247,0 +250,0 @@ var WebSockets = require('multiserver/plugins/ws`)

@@ -307,2 +307,14 @@ var fs = require('fs')

tape('wss with key and cert', function (t) {
var ws = Ws({
external: 'domain.de',
scope: 'public',
key: 'path',
cert: 'path'
})
t.equal(ws.stringify('public'), 'wss://domain.de')
t.equal(ws.stringify('local'), null)
t.equal(ws.stringify('device'), null)
t.end()
})

@@ -309,0 +321,0 @@ var onion = Onion({scope: 'public'})

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc