WS client in node bindings? #46
-
Hi there, first of all, I want to thank you for all the effort you are putting into this, and for sharing all your work via open source. I am following all your work since early versions of original uws for node. I was really shocked when was benchmarking new uWebsockets.js against golang ws and http implementations, in a day of new version release. I wasn't able to believe in number I am getting in node.js. You are actually the person who woken up me, and now I am working in benchmark oriented development process, where i am testing all my node_modules crap before i am starting to use it. I was frustrated by how bad everything is in node world, and how blindly people just following stars count. Realizing the mess around, i quit front-end development and started to learn C :). So thank you very much again. I just wanted to ask is there WS client available in uWebSocket.js? In the original version, it was pretty straight forward, how to connect to ws using uws but now i am unable to find a way, I only see how to use the server. Sorry for such a question, but I am not C++ dev, and it is pretty hard for me to answer this question, digging in your code. |
Beta Was this translation helpful? Give feedback.
Replies: 2 comments
-
Thanks for the nice words, there's no client support yet but if I get the time there might come such support. The reason this project focuses on server-only is because most companies who struggle with WebSocket performance struggle in the server department where many connections are held. Clients often only hold a handful, making less of an impact what library you use. You could use websockets/ws as client as long as you use µWS.js as server. I think the entire point of WebSockets is to communicate browser <-> server so you already have the client in the browser. |
Beta Was this translation helpful? Give feedback.
-
Your library has very strong potential. I personally use it for node.js IPC (old one). First of all, WS provides a very thin layer on top of TCP\TLS - WS frames, this helps to have messages, and you don't need to create some StreamReaders, and parse stream into messages in node land. This is very convenient. Second, the performance is crazy. I made some very simple benchmarks more than half a year ago, where I made one process server, and second process client on the same machine (in case of ZMQ it was DEALER-ROUTER, and in case of NATS it was one publisher one subscriber connected to NATS server), and was measuring time to receive 5 000 000 tiny messages (I know, that there are many quirks in measuring such way, but this is just to get approximate order of magnitude): https://github.com/uNetworking/uWebSockets-bindings/tree/master/nodejs TCP std lib. https://github.com/nats-io/node-nats https://github.com/zeromq/zeromq.js/ Unix Domain Sockets std lib https://github.com/rolftimmermans/zeromq-ng I have noticed socket.io-enterprise in your repo, I believe this will have a lot of sense in node land if I understand it correctly. |
Beta Was this translation helpful? Give feedback.
Thanks for the nice words, there's no client support yet but if I get the time there might come such support.
The reason this project focuses on server-only is because most companies who struggle with WebSocket performance struggle in the server department where many connections are held. Clients often only hold a handful, making less of an impact what library you use. You could use websockets/ws as client as long as you use µWS.js as server.
I think the entire point of WebSockets is to communicate browser <-> server so you already have the client in the browser.