Questions tagged [express-ws]
13 questions
3
votes
0 answers
Websocket uses more network bandwidth than http
I am doing a project and I got stuck with websockets. I am using express.ws library.
Lately, the app has worked without websockets at all: all the requests were sent from the client in a plain http request. However, my app is built so that the…

Fortnite
- 81
- 2
- 6
1
vote
2 answers
TypeError: router.ws is not a function express-ws typescript
I'm trying to create a websocket endpoint for router in my express app with express-ws module but getting an error.
Here is an entry point of the server index.ts:
import express from 'express';
import expressWs from 'express-ws';
import * as dotenv…

lian
- 399
- 1
- 3
- 16
1
vote
0 answers
Websocket failed when first time rendering - React
new WebSocket() is failing when I firest render the application, but when I refresh the page it reconnects and works properly
error -> WebSocket connection to 'ws://localhost:3001/?editorId=a3tq1&testId=noTestIdGiven' failed:
Adding this for more…

Noor AlManasrah
- 21
- 4
1
vote
0 answers
Handling many connections in node.js
I am making a live app with the use of websockets (express-ws npm package) in node.js.
The users send a message via ws every 10 seconds. Each of such requests takes about 1-1.5 milliseconds to handle (I have made some .time benchmarks). Everything…

Fortnite
- 81
- 2
- 6
0
votes
2 answers
How to set up a WebSocket server with Express.js (properly)?
Please let me know if this is a duplicate.
Description
I'll try to be concise. I have a barebones Express API with a WebSocket endpoint that I set up with express-ws following the docs, but it doesn't work. I can't tell where the problem…

roberto
- 15
- 6
0
votes
2 answers
Typescript class can't see methods (TypeError: Cannot read properties of undefined (reading 'method_name'))
While compiling there are no errors, compile fine. But when I call the method in the controller got an error. It looks like during the compilation class methods are missing.
If you need more information about the project config - please, ask - I…

Oleksii Nechaiev
- 13
- 3
0
votes
0 answers
Why is a connection not created for this simple websocket snippet?
I have a simple snippet on the front end as follows which I can verify is working. I can do this by changing the port to something other than 3000 and it will error.
It is definitely finding the server at that port:
// Create WebSocket connection…

user17331023
- 51
- 6
0
votes
1 answer
How properly take out logic of expressWs module in NodeJs?
Hello stackoverflow community.This is my first question on this site.
I spend two weeks struggling with how i can take out expressWs logic (chat window in frontend) to module and then import module in my NodeJS server file.
Presently ,with this code…

Anvar
- 452
- 3
- 5
0
votes
0 answers
Make a different connection center for the same express-ws function
first of all I want to apologize if my English is not perfect and if the title does not explain my situation very well.
I will summarize:
I created a code allowing to make different chat between several people using express-ws.
I decided to make a…

Stanley
- 63
- 7
0
votes
1 answer
websockets not working with https.createServer
Our websockets are working under Http/express but when I move to https.createServer I cant get a socket connention.
FYI:The project is almost complete and we are in deep with express-ws, so we cont change the socket lib at this stage
Here is an…

Brian
- 1,026
- 1
- 15
- 25
0
votes
1 answer
express-ws: add prototype via typescript
I'm using `express-ws` for WebSockets.
I want to extend the `WebSocket` class in the `ws` module that `express-ws` import and add it a string as prototype. (`WebSocket.prototype.str: string = ""`).
i should mention that I'm using typescript.
Who…

עתודה אקדמאית
- 385
- 3
- 10
0
votes
1 answer
Nodejs Websockets work Locally but not on Server
I am attempting to use the express-ws library with a nodejs server being hosted on gcloud. I'm using some basic starter code and it works when I run the code locally. However, if I try to connect when the code is being hosted on the web I receive an…

Dacoolinus
- 388
- 1
- 10
0
votes
2 answers
Is there anyway to use the websockets with express-ws and the WebSocket client api with an Angular Universal 9 app?
I am at a complete loss, as to what is going on, so I will post the Angular Universal server code that is running my express server.
I think there is something within Angular Unviersal's render engine that is completely just blocking…

Christian Matthew
- 4,014
- 4
- 33
- 43