awslabs / amazon-kinesis-video-streams-webrtc-sdk-android

Android SDK for interfacing with Amazon Kinesis Video Streams Signaling Service.
Apache License 2.0
58 stars 37 forks source link

WebSocketClient java.lang.ClassCastException: java.lang.Boolean cannot be cast to java.lang.String #61

Closed mjkimloan closed 3 years ago

mjkimloan commented 3 years ago

this problem in webrtcClient

    Endpoint endpoint = new Endpoint() {

        @Override
        public void onOpen(final Session session, final EndpointConfig endpointConfig) {
            Log.d(TAG, "Registering message handler");
            session.addMessageHandler(signalingListener.getMessageHandler());
        }

        @Override
        public void onClose(final Session session, final CloseReason closeReason) {
            super.onClose(session, closeReason);
            Log.d(TAG, "Session " + session.getRequestURI() + " closed with reason " +
                    closeReason.getReasonPhrase());
        }

        @Override
        public void onError(final Session session, final Throwable thr) {
            super.onError(session, thr);
            Log.w(TAG,"Session Error Caause // Message: " + thr.getCause() + "//" + thr.getMessage());
        }
    };

In onError, session is null and the reason for Throwable is Cannot cast java.lang.ClassCastException: java.lang.Boolean to java.lang.String. Is there a solution? also, Is there any effect on org.glassfish.tyrus.bundles:tyrus-standalone-client version?

mjkimloan commented 3 years ago

After changing the kotlin version it works fine.

ronbarrera commented 3 years ago

Hi, @mjkimloan I'm having the same issue, what Kotlin version are you using to solve this issue?

mjkimloan commented 3 years ago

@ronbarrera Hi !! We are using Kotlin version 1.4.32 and it has been confirmed that it does not work in later versions.

ronbarrera commented 3 years ago

@mjkimloan thanks. I'm using 1.4.32 and it works.

ronbarrera commented 2 years ago

@mjkimloan I was looking at the code and I was afraid to be stuck in 1.4.32. I was able to make it work kotlin_version: 1.5.30

Interesting enough, the code in SignalingListerner is as follow: val messageHandler: MessageHandler = Whole<String> { message ->}

I changed to: val messageHandler: object: Whole<string> { override fun onMessage(msg: String?) {msg?.let{}}}

and it worked. Hopefully, this helps.

mjkimloan commented 2 years ago

@ronbarrera Thank You and it worked.