Giter Club home page Giter Club logo

Comments (4)

jeffery30162 avatar jeffery30162 commented on May 24, 2024

Adding this to your Server.js resolves the issue:
/** * Publish a message to a topic in MQTT syntax. * You cannot publish using wildcards, only fully specified topics. * * @param {String} topic * @param {String|Buffer|ArrayBuffer} message * @param {Boolean=} is_binary * @param {Boolean=} compress */ publish(topic, message, is_binary, compress) { if (this.#uws_instance) return this.#uws_instance.publish(topic, message, is_binary, compress); return false; }

from hyper-express.

kartikk221 avatar kartikk221 commented on May 24, 2024

Yes, that is per-spec from how uWebSockets.js implements Pub/Sub with its web sockets. You can only publish a message from a Websocket object. See the uWebsockets.js documentation if you would like to discover more regarding why this was implemented in HyperExpress in this way.

from hyper-express.

kartikk221 avatar kartikk221 commented on May 24, 2024

Adding this to your Server.js resolves the issue: /** * Publish a message to a topic in MQTT syntax. * You cannot publish using wildcards, only fully specified topics. * * @param {String} topic * @param {String|Buffer|ArrayBuffer} message * @param {Boolean=} is_binary * @param {Boolean=} compress */ publish(topic, message, is_binary, compress) { if (this.#uws_instance) return this.#uws_instance.publish(topic, message, is_binary, compress); return false; }

I see, thanks for bringing this up. It seems the TemplatedApp.publish() method was implemented in updates after the original modules of Websocket/Server were written for HyperExpress.

Server.publish() has been implemented in v5.7.0. You may upgrade to use this method going forward.

from hyper-express.

jeffery30162 avatar jeffery30162 commented on May 24, 2024

Thanks
I tried cloning the master branch, was going to add code and try to commit but seems I am unauthorized.

from hyper-express.

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.