www.digitalmars.com         C & C++   DMDScript  

digitalmars.D.learn - Is there websocket client implementation for D

reply "Ilya Korobitsyn" <ilya-korobitsyn yandex.ru> writes:
Hello!

Is there any websocket client implementation in D?
I know there is WS server as a part of vibe.d, but it does not 
seem to include client.
Maybe there are some library bindings that I've missed?

Thank you,
Ilya
Mar 24 2015
next sibling parent Rikki Cattermole <alphaglosined gmail.com> writes:
On 25/03/2015 6:55 a.m., Ilya Korobitsyn wrote:
 Hello!

 Is there any websocket client implementation in D?
 I know there is WS server as a part of vibe.d, but it does not seem to
 include client.
 Maybe there are some library bindings that I've missed?

 Thank you,
 Ilya
It appears you are on your own.
Mar 24 2015
prev sibling next sibling parent reply "thedeemon" <dlang thedeemon.com> writes:
On Tuesday, 24 March 2015 at 17:55:38 UTC, Ilya Korobitsyn wrote:
 Hello!

 Is there any websocket client implementation in D?
There's some WebSocket stuff here: https://github.com/adamdruppe/arsd/blob/master/cgi.d It's for server side, but probably contains stuff you need for client too.
Mar 25 2015
parent reply "Adam D. Ruppe" <destructionator gmail.com> writes:
On Wednesday, 25 March 2015 at 07:12:56 UTC, thedeemon wrote:
 It's for server side, but probably contains stuff you need for 
 client too.
Yeah, I've been meaning to write a client for a while but haven't gotten around to it yet. What you do is make a HTTP request with a particular header, and if the server likes it, you're OK and can send messages. If not, the failure should be gracefully reported. Could probably write it up in a couple hours.... if I had a couple hours :(
Mar 25 2015
parent reply aberba <karabutaworld gmail.com> writes:
On Wednesday, 25 March 2015 at 15:46:31 UTC, Adam D. Ruppe wrote:
 On Wednesday, 25 March 2015 at 07:12:56 UTC, thedeemon wrote:
 It's for server side, but probably contains stuff you need for 
 client too.
Yeah, I've been meaning to write a client for a while but haven't gotten around to it yet. What you do is make a HTTP request with a particular header, and if the server likes it, you're OK and can send messages. If not, the failure should be gracefully reported. Could probably write it up in a couple hours.... if I had a couple hours :(
How about now?
May 21 2017
parent kerdemdemir <kerdemdemir gmail.com> writes:
Hi

vibe.d has a client implementation.

http://vibed.org/api/vibe.http.websockets/WebSocket

It is as simple as :


     auto ws_url = 
URL("wss://stream.binance.com:9443/ws/ethbtc aggTrade");
     auto ws = connectWebSocket(ws_url);
     if ( !ws.connected )
     	return;

     while ( true )
     {
     	if  (ws && ws.dataAvailableForRead())
     	{
     		writeln("Recieve", ws.receiveText());
     	}

     	sleep(100.msecs);	
     }	
Jun 11 2018
prev sibling parent reply Heromyth <bitworld qq.com> writes:
On Tuesday, 24 March 2015 at 17:55:38 UTC, Ilya Korobitsyn wrote:
 Hello!

 Is there any websocket client implementation in D?
 I know there is WS server as a part of vibe.d, but it does not 
 seem to include client.
 Maybe there are some library bindings that I've missed?
We just implemented one in D. See https://github.com/huntlabs/hunt-http/tree/master/examples/WebSocketDemo
Sep 10 2018
parent kerdem <kerdemdemir gmail.com> writes:
On Monday, 10 September 2018 at 07:19:03 UTC, Heromyth wrote:
 On Tuesday, 24 March 2015 at 17:55:38 UTC, Ilya Korobitsyn 
 wrote:
 Hello!

 Is there any websocket client implementation in D?
 I know there is WS server as a part of vibe.d, but it does not 
 seem to include client.
 Maybe there are some library bindings that I've missed?
We just implemented one in D. See https://github.com/huntlabs/hunt-http/tree/master/examples/WebSocketDemo
Hi I wish it would compiled than I would really give it a try. It seems WebSockets moved from hunt-http to hunt-web. hunt-web dependency not yet in dub. When I cloned hunt-web I couldn't get it compiled. I have created bug : https://github.com/huntlabs/hunt-http/issues/13 I hope you have time to fix it soon. Erdemdem
Dec 19 2019