websocket fail on bitmex

Hi Q Gods,

I got into the following issue by trying to connect to bitmex websocket but stuck for days.

h:`:ws://www.bitmex.com “GET /realtime HTTP/1.1\r\nHost: www.bitmex.com\r\n\r\n”

I got the following error:

(0Ni;"HTTP/1.1 301 Moved Permanently

Content-length: 0

Location: https://www.bitmex.com/realtime

")

My other websockets all work except the one above. For example, this is fine.

h:`:ws://ws.blockchain.info “GET wss://ws.blockchain.info/inv HTTP/1.1\r\nHost: ws.blockchain.info\r\n\r\n”

Thanks!!

301 status code tells you that you need to use the new URL as returned instead of the old one.

So what do I need to change exactly? change :ws to :wss?

problem solved. thanks for the tips

Correct URL is wss://www.bitmex.com/realtime<o:p></o:p>

<o:p> </o:p>

Using https://github.com/jonathonmcmurray/ws.q seems to work fine:<o:p></o:p>

<o:p> </o:p>

jmcmurray@homer ~/git/ws.q (master) $ q ws.q<o:p></o:p>

KDB+ 3.5 2017.11.30 Copyright (C) 1993-2017 Kx Systems<o:p></o:p>

l64/ 8()core 16048MB jmcmurray homer.aquaq.co.uk 127.0.1.1 EXPIRE 2018.06.30 AquaQ #50170<o:p></o:p>

<o:p> </o:p>

q).bmx.upd:show<o:p></o:p>

q).bmx.h:.ws.open[“wss://www.bitmex.com/realtime”;`.bmx.upd]<o:p></o:p>

q)"{"info":"Welcome to the BitMEX Realtime API.","version":"2018-04-24T18:56:54.000Z","timestamp":"2018-04-25T17:53:04.162Z","docs":"https://www.bitmex…<o:p></o:p>

<o:p> </o:p>

Hope that helps<o:p></o:p>

Jonathon<o:p></o:p>

<o:p> </o:p>

From: personal-kdbplus@googlegroups.com <personal-kdbplus@googlegroups.com> On Behalf Of rtrader
Sent: 25 April 2018 11:26
To: Kdb+ Personal Developers <personal-kdbplus@googlegroups.com>
Subject: [personal kdb+] Re: websocket fail on bitmex<o:p></o:p>

<o:p> </o:p>

how did you solve the problem? I am facing the same issue

On Thursday, December 28, 2017 at 8:45:48 AM UTC-6, agoodname wrote:<o:p></o:p>

problem solved. thanks for the tips

On Friday, December 22, 2017 at 10:49:48 AM UTC-5, agoodname wrote:<o:p></o:p>

So what do I need to change exactly? change :ws to :wss?

On Friday, December 22, 2017 at 5:55:33 AM UTC-5, Flying wrote:<o:p></o:p>

301 status code tells you that you need to use the new URL as returned instead of the old one.

On Friday, December 22, 2017 at 5:17:20 PM UTC+8, agoodname wrote:<o:p></o:p>

Hi Q Gods,<o:p></o:p>

<o:p> </o:p>

I got into the following issue by trying to connect to bitmex websocket but stuck for days.<o:p></o:p>

<o:p> </o:p>

h:`:ws://www.bitmex.com “GET /realtime HTTP/1.1\r\nHost: www.bitmex.com\r\n\r\n”<o:p></o:p>

<o:p> </o:p>

I got the following error:<o:p></o:p>

(0Ni;"HTTP/1.1 301 Moved Permanently<o:p></o:p>

Content-length: 0<o:p></o:p>

Location: https://www.bitmex.com/realtime<o:p></o:p>

<o:p> </o:p>

")<o:p></o:p>

<o:p> </o:p>

<o:p> </o:p>

My other websockets all work except the one above. For example, this is fine.<o:p></o:p>

<o:p> </o:p>

h:`:ws://ws.blockchain.info “GET wss://ws.blockchain.info/inv HTTP/1.1\r\nHost: ws.blockchain.info\r\n\r\n”<o:p></o:p>

<o:p> </o:p>

Thanks!!<o:p></o:p>


Submitted via Google Groups

yes the right uri is `wss.

still they need to configure the SSL wrapper in order to do this, just fyi