How to add username and password of kdb to web socket url?

2,659 views
Skip to first unread message

Roy Liu

unread,
Feb 25, 2016, 1:30:10 AM2/25/16
to Kdb+ Personal Developers

Hi All,


In javascript,  I need to pass the url to kdb for establishing the connection.

function connect_kdb(){

   if ("WebSocket" in window)

   {

      ws = new WebSocket("ws://127.0.0.1:6000");

      ws.binaryType = 'arraybuffer';

      ws.onopen=onopen

      ws.onclose=onclose;

      ws.onmessage=onmessage;

      ws.onerror=onerror;

   }

   else

      alert("WebSockets not supported on your browser.");

   }

}


how to add username and password of kdb to web socket url?


The following format does NOT work.

ws = new WebSocket("ws://127.0.0.1:6000:username:password");



Roy Liu

James Little

unread,
Feb 25, 2016, 3:13:07 AM2/25/16
to personal...@googlegroups.com

--
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-kdbpl...@googlegroups.com.
To post to this group, send email to personal...@googlegroups.com.
Visit this group at https://groups.google.com/group/personal-kdbplus.
For more options, visit https://groups.google.com/d/optout.

Jack Andrews

unread,
Feb 25, 2016, 3:13:25 AM2/25/16
to Kdb+ Personal Developers
http://stackoverflow.com/questions/6714966/basic-authentication-for-websockets

it mentions the format 'ws://user:pa...@127.0.0.1/')

but it also mentions that Chrome doesn't help you




--

Charles Skelton

unread,
Feb 25, 2016, 6:11:59 AM2/25/16
to personal...@googlegroups.com
I think they claimed to have fixed that in the meantime

Roy Liu

unread,
Feb 25, 2016, 8:09:07 PM2/25/16
to Kdb+ Personal Developers
It works: ws://username:pass...@127.0.0.1:6000 

Furthermore, the issue has fixed in Google Chrome.

Bres Emile

unread,
Feb 29, 2016, 7:58:17 AM2/29/16
to Kdb+ Personal Developers
It doesn't work for me. 

When I try to open a websocket with ws://username:password@127.0.0.1:6000 as URL, and define .z.pw as 

.z.pw:{[u;p] show u; show p; 1b}

it does open the connection but print

q)`
""

I tried with the latest q version (KDB+ 3.3 2016.02.22) and both Chrome and Firefox.


Le vendredi 26 février 2016 02:09:07 UTC+1, Roy a écrit :

Furthermore, the issue has fixed in Google Chrome.

On Thu, Feb 25, 2016 at 7:11 PM, Charles Skelton <cha...@kx.com> wrote:
I think they claimed to have fixed that in the meantime
On Thu, Feb 25, 2016 at 9:12 AM, Jack Andrews <eff...@gmail.com> wrote:
Reply all
Reply to author
Forward
0 new messages