porsager / pws Goto Github PK
View Code? Open in Web Editor NEWπ€ Persistent Web Sockets
License: Do What The F*ck You Want To Public License
π€ Persistent Web Sockets
License: Do What The F*ck You Want To Public License
I noticed there was a new release in npm, v4.0.6, but when i came to the repository to see the changes i didn't see them and saw the package.json is still 4.0.5, any reason for not updating the repository?
So i found this module which is exactly what i need, but it looks like the ws options
won't be passed correctly unless you pass a parameter for protocol
, i found out this while testing, i kept getting "401" when trying to connect and after that, i decided to check the headers of the request, the "authentication" header was missing, until i added a empty and not empty string as the second parameter (protocol) and the header was included in the request.
request that didn't work:
const ws = Pws("ws://localhost:9090", Websocket, {
headers: {
authentication: "test"
}
});
request that worked:
const ws = Pws("ws://localhost:9090", "", Websocket, {
headers: {
authentication: "test"
}
});
The exposed interface does not allow to use ws options so it is not possible, for example, to disable CPU intensive extensions like permessage-deflate.
I am using the pingTimeout
option and when the server does not send a message in a while, just as pws is about to close the connection, it crashes with βCannot assign to read only property 'code' of object '#'β
Chrome 73.0.3683.103, but MDN agrees that the property is read-only.
According to the documentation on the readme of this repo,
To prevent this state PWS let's you set a specific timeout after which to force a reconnection if you did not receive any messages from the server.
However, what I observe is that if I set pingTimeout, the socket connection closes after that amount of time and does not re-connect.
Is there a way to use this without node?
This is very useful when connection is aborted and you are trying to send something unsuccesfully. Until connection is open again, all data are buffered and will be sent once reconnection happened
I set the "maxRetries" option to N. But after reaching maximum retry it keeps retrying. I found the bug in the code.
I think this line is the issue -
Line 207 in 9a1e11c
A declarative, efficient, and flexible JavaScript library for building user interfaces.
π Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. πππ
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google β€οΈ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.