Code Monkey home page Code Monkey logo

Comments (5)

alliv8 avatar alliv8 commented on August 20, 2024 1

You have to bind aedes to wss, not a new tcp server.

var http = require('http')
var websocket = require('websocket-stream')
var RedisPersistence = require('aedes-persistence-redis')()
var aedes = require('aedes')({
    concurrency: 1000,
    persistence : RedisPersistence
})

var httpServ = http.createServer()
var port = 1884

var wss = websocket.createServer({server: httpServ, port: port}, aedes.handle)

This should work

from aedes.

mcollina avatar mcollina commented on August 20, 2024

This is not in the scope of this project, and it will be integrated with Mosca soon. You can achieve the same thing by using http://npm.im/websocket-stream.

from aedes.

debjeetsarkar avatar debjeetsarkar commented on August 20, 2024

I am sending my client side packet using mows.js and I am trying to pass the incoming stream to aedes using websocket-stream . Here is my code snippet

var http = require('http')
var websocket = require('websocket-stream')
var RedisPersistence = require('aedes-persistence-redis')()
var aedes = require('aedes')({
    concurrency: 1000,
    persistence : RedisPersistence
})

var httpServ = http.createServer()

var wss = websocket.createServer({server: httpServ},handle)

function handle(stream){
    stream.pipe(server)
}

var server = require('net').createServer(aedes.handle)
var port = 1884 


httpServ.listen(port, function (req,res) {
  console.log('server listening on port', port)
})

from aedes.

mcollina avatar mcollina commented on August 20, 2024

@alliv8 explained it perfectly.

from aedes.

debjeetsarkar avatar debjeetsarkar commented on August 20, 2024

Got a clear idea , Thanks @alliv8 .

from aedes.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.