So there was a bug in my ws.q library I didnt realise that kdb+ already adds a number of WebSocket-related headers to requests to ws:// or wss:// URLs; my library added some of these headers as well, which caused problems on some hosts (I guess any Id tried before just ignored duplicated headers)<o:p></o:p>
<o:p> </o:p>
I have updated the library so that it now works with the hitbtc example:<o:p></o:p>
<o:p> </o:p>
q).hbc.upd:{show .j.k x};<o:p></o:p>
q).hbc.h:.ws.open[“wss://api.hitbtc.com/api/2/ws”;`.hbc.upd]<o:p></o:p>
q).hbc.h .j.j method
paramsid!(
getCurrency;(1#currency)!1#
ETH;123)<o:p></o:p>
q)jsonrpc| “2.0”<o:p></o:p>
result | id
fullNamecrypto
payinEnabledpayinPaymentId
payinConfirmationspayoutEnabled
payoutIsPaymentIdtransferEnabled
delisted`payoutFee!(“ETH”;“Ethereum”;1b;1b;0b;2f;1b;0b;1b;0b;“0.00958”)<o:p></o:p>
id | 123f<o:p></o:p>
<o:p> </o:p>
GitHub issue:https://github.com/jonathonmcmurray/ws.q/issues/1<o:p></o:p>
<o:p> </o:p>
From: personal-kdbplus@googlegroups.com <personal-kdbplus@googlegroups.com> On Behalf Of Jake
Sent: 23 May 2018 18:48
To: Kdb+ Personal Developers <personal-kdbplus@googlegroups.com>
Subject: [personal kdb+] Connecting to websocket issue<o:p></o:p>
<o:p> </o:p>
I have been able to connect to many similar websockets using this same set up.<o:p></o:p>
<o:p> </o:p>
here is the domain wss://api.hitbtc.com/api/2/ws<o:p></o:p>
<o:p> </o:p>
For some reason this one will not connect. I have gotten the domain to respond in wscat, so I’m sure it’s a valid request. <o:p></o:p>
<o:p> </o:p>
Here is what I’ve tried:<o:p></o:p>
<o:p> </o:p>
- Simple connect <o:p></o:p>
<o:p> </o:p>
r::(`$“:ws://api.hitbtc.com”)“GET /api/2/ws HTTP/1.1\r\nHost: api.hitbtc.com\r\n\r\n”;
show r<o:p></o:p>
<o:p> </o:p>
result: <o:p></o:p>
<o:p> </o:p>
'.z.ws undefined
[0] show r<o:p></o:p>
<o:p> </o:p>
- Using this library: https://github.com/jonathonmcmurray/ws.q<o:p></o:p>
<o:p> </o:p>
\l ws.q
.hbc.upd:{.hbc.x,:enlist x}
.hbc.h:.ws.open[“ws://api.hitbtc.com/api/2/ws”;`.hbc.upd] <o:p></o:p>
<o:p> </o:p>
result: <o:p></o:p>
<o:p> </o:p>
q).hbc.h
0Ni<o:p></o:p>
<o:p> </o:p>
showing there is no connection where there should be… and here, <o:p></o:p>
<o:p> </o:p>
q).ws.w
<o:p> </o:p>
it shows nothing in the h column, which means there is no connection.<o:p></o:p>
<o:p> </o:p>
Any help would be greatly appreciated! Thanks in advance. <o:p></o:p>
–
Submitted via Google Groups