Comments (4)
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.
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.
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.
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)
- Feature request: swagger HOT 1
- No error thrown if invalid json is sent as body HOT 4
- From version 6.0.0, the response component doesn´t call a close or abort event when the SSE client is closed HOT 1
- Nest-hyper-express-adapter middleware tests failing HOT 4
- Nest-hyper-express instance and local-pipes tests each fail one test HOT 3
- Outdated example of static serving / LiveDirectory HOT 1
- Error: uWS.HttpResponse must not be accessed after uWS.HttpResponse.onAborted callback HOT 1
- Graceful shutdown HOT 4
- Static serving HOT 1
- No error on binding to the same port HOT 1
- No Socket Received From uWebsockets.js likely due to an invalid host or busy port. HOT 2
- Optional Parameter Route HOT 2
- Read JSON as raw HOT 4
- Listen on IPv6 by default HOT 1
- Client certificate validation HOT 1
- v6.15.0 introduces breaking changes with the new server.listen unix socket method HOT 1
- Get Hyper-Express to feature parity with Express HOT 2
- missing Promise return type on shutdown HOT 1
- run on aws lambda HOT 1
- Vite middleware support: Request type missing export and `.originalUrl` method & `url` setting HOT 7
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
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.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from hyper-express.