![JAR search and dependency download from the Maven repository](/logo.png)
node_modules.websocket-stream.server.js Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of libjoynr-js Show documentation
Show all versions of libjoynr-js Show documentation
JOYnr JavaScript libjoynr-js
'use strict'
var WebSocketServer = require('ws').Server
var stream = require('./stream')
class Server extends WebSocketServer{
constructor(opts, cb) {
super(opts)
var proxied = false
this.on('newListener', function(event) {
if (!proxied && event === 'stream') {
proxied = true
this.on('connection', function(conn, req) {
this.emit('stream', stream(conn, opts), req)
})
}
})
if (cb) {
this.on('stream', cb)
}
}
}
module.exports.Server = Server
module.exports.createServer = function(opts, cb) {
return new Server(opts, cb)
}
© 2015 - 2025 Weber Informatics LLC | Privacy Policy