websocketd icon indicating copy to clipboard operation
websocketd copied to clipboard

A client like websocketd

Open sim6 opened this issue 9 years ago • 23 comments

Firstly, thanks for your work. I like websocketd and works fine for me.

Do you know a websocket client like websocketd?

sim6 avatar May 10 '15 16:05 sim6

Any comments on intent? Technically it's not hard, few days of not intense part-time hacking but I do not see benefit for the project yet.

asergeyev avatar May 10 '15 23:05 asergeyev

BTW a huge +1 from me on this. There was one I used a while back (I can't remember the name, I think it was written in Ruby, or possibly Node). I always thought it would be useful if websocketd had a companion project: websocketc.

Here's where it's useful:

  • Quick cmd line testing of endpoints (like curl)
  • Shell scripting (e.g. fetching data from services to feed into scripts)
  • Transformations (e.g. a websocketd endpoint could call websocketc and transform live results)
  • Wiring backend services together without browsers (WebSockets have some value-add on top of raw TCP sockets including path based routing, headers, authentication, and message framing)

joewalnes avatar May 11 '15 02:05 joewalnes

How will we call it ? :)) wscat? :)

  tail -f mylog | wscat http://server:port
  wscat http://sever:port > output

Like this?

Still line==message protocol, right? (which also makes it different from curl with fake WS headerset)

asergeyev avatar May 11 '15 02:05 asergeyev

Wow.. believe or not but I was making name and apparently I guessed to this: https://www.npmjs.com/package/wscat

asergeyev avatar May 11 '15 02:05 asergeyev

but since someone posted https://www.npmjs.com/package/websocketdjs I think stealing name is bad thing :)

how about websocketc then?

asergeyev avatar May 11 '15 02:05 asergeyev

Thanks!

https://github.com/websockets/wscat doesn't wait for a connection to process the input (https://github.com/websockets/wscat/issues/4) and I cannot pipe the output.

wsdump from https://github.com/liris/websocket-client decorates de output and breaks with piped input (https://github.com/liris/websocket-client/issues/183).

https://github.com/daniellandau/wssh doesn't process my input.

sim6 avatar May 11 '15 08:05 sim6

If someone starts on it, mark the ticket please. So far I think I can only get to it closer to end of May... It's really small thing to do and it's silly to make excuse but I just have to focus on other project this/next week.

asergeyev avatar May 13 '15 00:05 asergeyev

The issue of wsdump was solved :) And I modified it to run the way I wanted. https://github.com/liris/websocket-client/pull/186

sim6 avatar May 14 '15 16:05 sim6

I'll keep it open for a bit, we may better to have one anyway, just to test libs as well.

asergeyev avatar May 14 '15 20:05 asergeyev

It's fine!

sim6 avatar May 14 '15 20:05 sim6

One use case for this client is so that git can use websocket as a transport, which would be more efficient than git's plain http support.

pclouds avatar May 26 '16 08:05 pclouds

I can see many reasons for this. For example, I build Home Automation solutions on ARM-based systems and need to connect via ws. Currently I use various libraries which haven't been very suitable in this case. Something just like websocketd for client would be awesome to have!

In my case I can't easily run many languages (other than tcl) so all the python and perl and whatever other scripts might exist never end up being very helpful. I have it all running in tcl but a go-based binary would be absolutely awesome!

bradennapier avatar Feb 13 '17 10:02 bradennapier

@bradennapier Can you try to describe how you see this one work?

Say someone runs websocketd server somewhere... then idea is to use wscat like program on your laptop or micro-computer to do what? I really lack context here... What data will be input and where will it go normally for automation for example? How much messages, will they all be plain text?

asergeyev avatar Feb 13 '17 19:02 asergeyev

I mean lets say the simple case where you want to connect to a websocket server and communicate with it. In my case I have a system behind a LAN and I connect to the websocket server running on the server from the LAN so that I can begin two-way communication to and from without port forwarding.

I would imagine it work the same way - the program simple connects the websocket

websocketc --address=serverpath --port=port ...

then websocketc executes the given program immediately (and assumes it would likely stay connected until terminated by one end) and writes to stdin / out so that the application can now listen to that and communicate with the server.

I would use primarily json but i would imagine it wouldn't matter

bradennapier avatar Feb 20 '17 20:02 bradennapier

I was thinking of writing a vim plugin that communicated to a server via websockets. I haven't fleshed out the idea, but having something like websocketc to tie into vim would be pretty nifty.

chipsenkbeil avatar Feb 23 '17 21:02 chipsenkbeil

A websocketc would be super useful for me as well! I'm using (the awesome) websocketd because I'm writing performance-critical computer vision code in C++, which is a tough language to develop in especially by today's standards, so it's a lifesaver to be able to simply read/write on the console to send the data; then I can keep the C++ code to only computer vision code. I will have more than one of these nodes, connected in a chain or hub pattern, so I am also looking for a similarly simple "websocketc" solution.

voxoid0 avatar Sep 11 '17 10:09 voxoid0

Was there any progress on this? I would still be pretty useful...

So ++1

tiptronic avatar Mar 03 '19 18:03 tiptronic

A websocketc instance that simply runs as a client capable to have a constant connection to another node with websocketd would be useful in so many cases.

I personally had that need in the last couple of months and I ended up writing custom ncat solution in one case, and php solution for the other. Alas, they are both proprietary so I can't share the codebase.

Bottom line, I truly believe that bundling this up in the project will have vast success!

xPh03n1x avatar Mar 04 '19 11:03 xPh03n1x

I'm interested in a websocketc (a client using python) for data gathering live datasets for data science from websockets all across the internet. I tried websocket-client but I couldn't get it to work. [https://github.com/websocket-client/websocket-client/issues/560]

gityou123 avatar Jul 11 '19 00:07 gityou123

Not exactly what most of these comments are looking for, but I had a use case for a browser based way to easily connect to, view, and manage websocketd servers. Might be helpful! Websocketc.com

andrewmh20 avatar Apr 29 '20 06:04 andrewmh20

@andrewmh20 -> trying to connect to the site quickly exposed the problem: the site took 10++ seconds to load, so a real (local) client would be preferable...

tiptronic avatar Apr 30 '20 08:04 tiptronic

@andrewmh20 -> trying to connect to the site quickly exposed the problem: the site took 10++ seconds to load, so a real (local) client would be preferable...

That’s because it’s running on free heroku right now....didn’t realize it was so bad but I should fix that if people are looking. All the actual connections are made directly from the client to whatever url you put in, including local ones.

andrewmh20 avatar Apr 30 '20 14:04 andrewmh20

Wrapping that in a binary client which would run locally would be a good thing, however :)

tiptronic avatar Apr 30 '20 14:04 tiptronic