Thread overview
Is there websocket client implementation for D
Mar 24, 2015
Ilya Korobitsyn
Mar 25, 2015
Rikki Cattermole
Mar 25, 2015
thedeemon
Mar 25, 2015
Adam D. Ruppe
May 21, 2017
aberba
Jun 11, 2018
kerdemdemir
Sep 10, 2018
Heromyth
Dec 19, 2019
kerdem
March 24, 2015
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
March 25, 2015
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.
March 25, 2015
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.
March 25, 2015
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 :(
May 21, 2017
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?
June 11, 2018
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);	
    }	
September 10, 2018
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

December 19, 2019
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