Android Question Websocket with Headers (Client)

jtare

Active Member
Licensed User
Longtime User
Looking in the autobahn websocket github I noticed that the connect method allow you to insert headers, obviously the websocket wrapper doesn't allow you to set them, but can that part of the library be called by using a javaobject or with the reflection library? And what's the proper way to do it?

I tried this but it didn't work:
B4X:
        Dim jo As JavaObject
        jo.InitializeContext
        jo = ws
        jo.RunMethod("connect",Array As Object(Url,Null,Null,Null,CreateMap("Auth":"123")))

This is the java method:
B4X:
@Override
    public void connect(String wsUri, String[] wsSubprotocols,
                        IWebSocketConnectionHandler wsHandler, WebSocketOptions options,
                        Map<String, String> headers) throws WebSocketException {

I believe the "IWebSocketConnectionHandler wsHandler" is important and shouldn't pass null value.

Thanks.
 
Top