OK.

I tried it and found:  sock.Open(  does not accept "/ws/v2/?&token=<token>"  only the server name

USER>set sock = ##class(%IO.Socket).%New()
USER>do sock.Open("localhost/csp/samples/Web.SocketTest.cls",8080,5,.sc)  //// >>> Timeout
/// but this works
USER>do sock.Open("10.10.12.87",57772,5,.sc) zw sc
sc=1
USER>zw sock
sock=<OBJECT REFERENCE>[2@%IO.Socket]
+----------------- general information ---------------
|      oref value: 2
|      class name: %IO.Socket
| reference count: 2
+----------------- attribute values ------------------
|        (%Attached) = ""
|(%CurrLineTerminator) = ""
|              AtEnd = 0
|       CharEncoding = "Native"  <Set>
|               Host = "10.10.12.87"
|    InputBufferSize = 32767
|             IsOpen = 1  <Get>
|       IsSingleByte = ""
|  KeepAliveInterval = 0
|     LineTerminator = $c(10)
|     LocalInterface = ""
|               Name = "|TCP|57772|20242"
|   OutputBufferSize = 32767
|               Port = 57772
|             Remote = "2019-02-05 10:33:35.212|10.10.12.87:57772"
|          SSLConfig = ""
|   TCPReceiveBuffer = 0
|      TCPSendBuffer = 0
|   TranslationTable = "RAW"  <Set>
+----------------- swizzled references ---------------
|i%DisconnectHandler = ""
|r%DisconnectHandler = ""
+--------------- calculated references ---------------
|DefaultFlushOnWrite   <Get>
|        IsCharacter   <Get>
+-----------------------------------------------------
USER>

Now you have the connection BUT no server to take care of it as you see:

USER>do sock.WriteLine("/csp/samples/Web.SocketTest.cls",1,.sc) zw sc
sc=1
USER>write sock.ReadAny(32000,5,.rSC) zw rSC
HTTP/0.9 404 Stream Not Found
Content-Type: text/html; charset=utf-8
Date: Tue, 05 Feb 2019 10:45:16 GMT
Expires: Tue, 05 Feb 2019 11:45:16 GMT

rSC=1


Investigating the browser it became clear what's going on:
- you begin with HTTP to start your WebSocketServer
- an then initiate the WS connection.

This is the output from TcpTrace: 

>>>>>  GET /csp/samples/websocketdemo.csp HTTP/1.1 >> .......

<<<<<  HTTP/1.1 200 OK  << Date: Tue, 05 Feb 2019 10:55:01 GMT << Server: Apache <<<<...

>>>>>  GET /csp/samples/Web.SocketTest.cls HTTP/1.1  >> ... >> Upgrade: websocket

<<<<<  HTTP/1.1 101 Switching Protocols << Upgrade: websocket << Connection: Upgrade << Sec-WebSocket-Accept:

That's my point:
      With the actual approach starting the requres WS Server is missing. 

To me, this looks like your port doesn't like WS as initial connection protocol but expect the switch from HTTPS -> WSS or the port is just wrong.

several suggestions for the investigation to get it moving:

#1) verify your server from a normal web page (e.g. based websocketdem.csp in Samples) especially the port !!!!

#2) If you have control over your server then skip SSL and get running over HTTP -> WS first. You can add this once it works.

#3) If you have no server just use Caché / SAMPLES /  Web.SocketTest.cls 
I found it very useful to have control over both ends and now I own several variants for testing.

Staying tuned yes

#1) if it is a Caché Backup you need an Installation of Caché to restore it.

#2) if it is a CACHE.DAT file you also need an installation of Caché and mount this as an additional DataBase.

Without the installation of Caché it's a thrilling exercise to high-level experts. Not really advisable.

try to have the same processor type { big / little endian :== (Intel/AMD) or not } as the original Caché instances. This saves some headache.

Forget about SQL Server. Caché is far more  efficient and advanced technology!

 #1)

You need to get %Net.HttpRequest in hands to set your property Content Type.

#2)

instead of PutURL(...) you have to use method SendFormDataURL(....)  of EnsLib.HTTP.OutboundAdapter

more details in docs here:

Creating Custom HTTP Requests

If you use the more common methods of the HTTP outbound adapter (such as Get), the adapter automatically creates and sends an HTTP request, which can include either form data or a request body. In special cases, you may want to create a custom HTTP request so that you can specify details such as proxy authorization or a different character encoding.

You could use the feature that any Classmethod may also serve as Stored Procedure.

Like this:

Class User.Remote
{
ClassMethod Echo(inout As %String) As %String [ SqlName = Demo, SqlProc ]
return "Echo:"_inout }
}

And then you may call your Procedure like this: getting back

SELECT DEMO('hello WORLD') 

getting back   

Echo:hello WORLD

All you have to care for is to return something.
what happens inside your ClassMethod is up to you and doesn't need to be related.

As you have an installation of Caché you will also have the Documentation with it.

I recommend "Using Caché ObjectScript" to start with ObjectScript.
It is also public accessible https://docs.intersystems.com/latest/csp/docbook/DocBook.UI.Page.cls?KEY=GCOS

I also recommend having a look at the free online training library.
The link is in the header of this forum:  LEARNING

Browse Catalog and search for O bjectScript Basics

All details on individual commands, functions, system variables are again in your local instance or in the
public reference on docs.intersystems.com

My personal preference is to a have a solution NOW.
And not wait for something that may take too long for me.

just the most simple example to solve your issue with a ClassMethod:

Class nodes.Select
{
ClassMethod Address1(town As %String = "") As %String
{ set (list,id)=""
    for  set id=$o(^Customer(id)) quit:id=""  
            if ^(id,"Address",1)=town set list=list_$lb(id) }
   return "["_$lts(list)_"]"
}}

See details in NoSQL Methods for Global Nodes

Especially  Get the Next Global Subscript: next() lets you iterate over first subscript  ^Customer(id)   1, 2, 3, ...

next using Retrieve a Global Node: get() you access ^Customer(id, "Address", 1) and check if it is "London"

from docs mydata.retrieve 

This method will return a list of subscript values that are defined directly beneath a given level in the global.

In your call, you get the full global. but you have to do the detail work yourself.

There is no such thing as SELECT ...... FROM GLOBAL WHERE .......

This is NoSQL.

But you may hide your functionality in a ClassMethod inCaché and use invoke_classmethod()

Without offering a solution to develop this magic data type that Julius suggested
You should also define what datatype you plan to present for the SQL side.
And that is always taken from the Compiled Property definition.

All streams typically present themselves a CLOB or BLOB or similar and have no MAXsize
While a String presents itself as a VARCHAR with a MAXSIZE.
I see no way to manipulate this on the fly.

For object access, you may write a Setter and Getter that covers the real nature of your data:
For SQL access I see no chance at the moment.

Indexing is another issue. This would require another piece of magic.

My suggestion:
have a %String
have a %Stream
and have a calculated property of  %String to decide which one to present.

like a centipede with a wooden leg: 99 times tic and 1 toc

the stream is then truncated and still requires extra coding.