-
Notifications
You must be signed in to change notification settings - Fork 141
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
This project seems to be dead #135
Comments
This project works, your comment is useless. |
It may still work, but it definitely isn't actively maintained. Last publish at least 2 years ago, last commit 2.5 years, more than 50 open issues. @xtianus79 thank you for the very useful warning :) |
@Janaka-Steph it absolutely is not working. Try to use this with any new layer of express and it doesn't work without issue or warning or emitted errors. |
@xtianus79 It works for me with Node 14, latest version of express, latest version of expressWs and Typescript. Here is a quick example
|
@Janaka-Steph Are you able to get it to work on with express.Router() routes? This isn't working for me on any apps that are updated to new versions - I haven't tried using {Application} from express-ws maybe this is what is going wrong? Where is that referenced in the docs? :-) |
I didn't try with express.Router() sorry.
is the same as
is the same as
|
with type script, const wsInstance : expressWs.Instance = expressWs(eApp, server); roomRouter.ws( const RoomController = (socket : ws, req : Express.Request) : void => { something like this works for me. |
still works but definitely not maintained. |
Are there any good alternatives? I'm writing an express app and I need to implement regular rest API, but I want one endpoint to use websockets. I know it's out of spec and bad practice, but I need to post data with an esp32 several times a second, and regular HTTP just isn't cutting it. |
@andraz213 I don't know about an other lib, but if your communication is one-way maybe you should consider Server-Sent Events instead. |
@andraz213 Since you're in control of the client, you could always just open an HTTP request and continue to stream your data under the same request. No need for the web sockets layer. |
In case it helps, I’m using my fork (https://github.com/aral/express-ws) in Site.js (https://sitejs.org). |
sorry for shameless plug but in case someone is looking for another express + ws middleware I've just published tinyws. Might be useful for those who want to use something newer than express-ws. this is how you can use it with express: import express from 'express'
import { tinyws } from 'tinyws'
const app = express()
app.use('/', tinyws())
app.use('/hmr', async (req, res) => {
if (req.ws) {
const ws = await req.ws()
return ws.send('hello there')
} else {
res.send('Hello from HTTP!')
}
})
app.listen(3000) |
I created a new project, the code looks simpler and has more useful features, I hope it helps you.
|
it's not working anymore.
The text was updated successfully, but these errors were encountered: