cancel
Showing results for 
Search instead for 
Did you mean: 

websocket fail on bitmex

agoodname
New Contributor
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!!
5 REPLIES 5

Flying
New Contributor III
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

Jonathon_McMurr
New Contributor

Correct URL is wss://www.bitmex.com/realtime

 

Using https://github.com/jonathonmcmurray/ws.q seems to work fine:

 

jmcmurray@homer ~/git/ws.q (master) $ q ws.q

KDB+ 3.5 2017.11.30 Copyright (C) 1993-2017 Kx Systems

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

 

q).bmx.upd:show

q).bmx.h:.ws.open["wss://www.bitmex.com/realtime";`.bmx.upd]

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...

 

Hope that helps

Jonathon

 

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

 

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:

problem solved. thanks for the tips

On Friday, December 22, 2017 at 10:49:48 AM UTC-5, agoodname wrote:

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:

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:

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

 

")

 

 

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!!

--
You received this message because you are subscribed to the Google Groups "Kdb+ Personal Developers" group.
To unsubscribe from this group and stop receiving emails from it, send an email to personal-kdbplus+unsubscribe@googlegroups.com.
To post to this group, send email to personal-kdbplus@googlegroups.com.
Visit this group at https://groups.google.com/group/personal-kdbplus.
For more options, visit https://groups.google.com/d/optout.


This e-mail message is intended to be received only by persons entitled to receive the confidential information it may contain. E-mail messages to clients of AquaQ Analytics may contain information that is confidential and legally privileged. Please do not read, copy, forward, or store this message unless you are an intended recipient of it. If you have received this message in error, please forward it to the sender and delete it completely from your computer system.

yes the right uri is `wss.

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