websocket returns 0Ni, what am I doing wrong?

What am I doing wrong?

$ qKDB+ 3.5 2017.06.15 Copyright (C) 1993-2017 Kx Systemsm32/ 4()core 8192MB xxx xxx 192.168.86.21 NONEXPIRE q).z.ws:{0N!x;}q)r:($“:ws://sdf.lonestar.org:80”)"GET / HTTP/1.1\r\nHost: host:port\r\n\r\n"q)r0Ni"HTTP/1.1 200 OK\r\nDate: Tue, 04 Jul 2017 00:47:01 GMT\r\nServer: Apache/2.2.31 (Unix) mod_ssl/2.2.31 OpenSSL/1.0.2h\r\nTransfer-Encoding: chunked\r\nContent-Type: text/html\r..q)r:($":ws://sdf.lonestar.org:80")"GET / HTTP/1.1\r\nHost: sdf.lonestar.org:80\r\n\r\n"q)r0Ni"HTTP/1.1 200 OK\r\nDate: Tue, 04 Jul 2017 00:47:20 GMT\r\nServer: Apache/2.2.31 (Unix) mod_ssl/2.2.31 OpenSSL/1.0.2h\r\nTransfer-Encoding: chunked\r\nContent-Type: text/html\r\..q)

Are you sure that sdf.lonestar.org:80 supports websocket at all?

I tested this site with websocket.org’s demo, and it was quite obvious that the site does not support websocket – unexpected status code returned from the site.

Thanks for the update.  I incorrectly assumed that if a webserver supported HTTP 1.1 it would support WebSockets.
Is there an known host that you know of that does support WebSockets?

https://www.websocket.org/echo.html

http://code.kx.com/q/cookbook/websockets/#simple-websocket-client-example

I assume ws is normal and wss is secure.

Cool - it kind of works.  I have to setup secure sockets though.

p.p1 {margin: 0.0px 0.0px 0.0px 0.0px; font: 13.0px Menlo; color: #d0d2da; background-color: #161821; background-color: rgba(22, 24, 33, 0.95)}span.s1 {font-variant-ligatures: no-common-ligatures}

q).z.ws:{0N!x;}

q)r:(`$“:ws://echo.websocket.org:80”)“GET / HTTP/1.1\r\nHost: host:port\r\n\r\n”

'close

  [0]  r:(`$“:ws://echo.websocket.org:80”)“GET / HTTP/1.1\r\nHost: host:port\r\n\r\n”

         ^

q)r:(`$“:wss://echo.websocket.org:80”)“GET / HTTP/1.1\r\nHost: host:port\r\n\r\n”

13790:error:02001002:system library:fopen:No such file or directory:/BuildRoot/Library/Caches/com.apple.xbs/Sources/OpenSSL098/OpenSSL098-64.50.6/src/crypto/bio/bss_file.c:356:fopen(‘/System/Library/OpenSSL/server-crt.pem’,‘r’)

13790:error:20074002:BIO routines:FILE_CTRL:system lib:/BuildRoot/Library/Caches/com.apple.xbs/Sources/OpenSSL098/OpenSSL098-64.50.6/src/crypto/bio/bss_file.c:358:

13790:error:140AD002:SSL routines:SSL_CTX_use_certificate_file:system lib:/BuildRoot/Library/Caches/com.apple.xbs/Sources/OpenSSL098/OpenSSL098-64.50.6/src/ssl/ssl_rsa.c:470:

13790:error:02001002:system library:fopen:No such file or directory:/BuildRoot/Library/Caches/com.apple.xbs/Sources/OpenSSL098/OpenSSL098-64.50.6/src/crypto/bio/bss_file.c:126:fopen(‘/System/Library/OpenSSL/cacert.pem’,‘r’)

13790:error:2006D080:BIO routines:BIO_new_file:no such file:/BuildRoot/Library/Caches/com.apple.xbs/Sources/OpenSSL098/OpenSSL098-64.50.6/src/crypto/bio/bss_file.c:129:

13790:error:0B084002:x509 certificate routines:X509_load_cert_crl_file:system lib:/BuildRoot/Library/Caches/com.apple.xbs/Sources/OpenSSL098/OpenSSL098-64.50.6/src/crypto/x509/by_file.c:274:

'conn. OS reports: Protocol not available

  [0]  r:(`$“:wss://echo.websocket.org:80”)“GET / HTTP/1.1\r\nHost: host:port\r\n\r\n”

         ^