Skip to content

Exception while connecting "java.net.MalformedURLException: unknown protocol: wss" #555

Closed
@aalap03

Description

@aalap03

My Socket url is of form "wss://socket-..." and inside that I want to subscribe to the channel of form "myChannel.website.com"

I am using this code to connect to the channel but it gives java.net.MalformedURLException: unknown protocol: wss error.

try {
        socket = IO.socket(SERVER_URL + cobaltStore.getToken());
        socket.connect();
        Log.d(TAG, "testSocket: connected? "+socket.connected());
        socket.on(channel, args -> {
            for (Object arg : args) {
                Log.d(TAG, "testSocket: call: " + arg);
            }
        });

    } catch (Exception e) {
        e.printStackTrace();
        Log.d(TAG, "testSocket: "+e.getLocalizedMessage());
    }

Please let me know what I am doing wrong and guide me to the correct way to connect to the socket and channel.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions